1 reply [Last post]
Alexandurrr
Alexandurrr's picture
Offline
newbie
Madison, WI
Last seen: 3 years 3 weeks ago
Madison, WI
Timezone: GMT-5
Joined: 2011-10-12
Posts: 5
Points: 7

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

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 4 days 14 hours ago
London
Joined: 2004-06-06
Posts: 15667
Points: 2805

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.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me