Sat, 2011-10-22 14:09
Hello everybody,
my website: www.alexdoesgraphics.com
My questions is about the javascript near the bottom of my page that I use to scroll the website vertically. Instead of placing it at the bottom of the document after my body tags, I want to know if its possible to pull this block of code in externally, kind of like you would an external style sheet.
<!-- The Javascript for the scroll effect "Easing" -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script type="text/javascript">
$(function() {
$('ul.nav a, a.banner, a.continue, a.continue2, a.continue3, a.blackarrow, a.whitearrow').bind('click',function(event){
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 950,'easeInOutExpo');
/*
if you don't want to use the easing effects:
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1000);
*/
event.preventDefault();
});
});
</script>
<script>
!window.jQuery && document.write('<script src="js/jquery-1.4.3.min.js"><\/script>');
</script>I am in the final stages of development and I want to clean up my code.
Thanks in advance,
Alex
Sat, 2011-10-22 20:17
#1
Simply cut and paste it into
Simply cut and paste it into a file and call it in the head using script tags, you might also want to call the jQuery library from one of the available cloud resources such as cloudfare offer.