Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Mar 2010
    Posts
    104
    Member #
    21316
    Liked
    1 times
    Hi,

    I've noticed at the bottom of my website before the closing </body> tag some javascript I've used before for SMOOTH SCROLLING:

    Code:
    <script src="http://www.google.com/jsapi" type="text/javascript"></script>
    <script type="text/javascript">
            google.load("jquery", "1.2.6");
        </script>
    <script type="text/javascript" src="../example.js"></script>
    I like the smooth scrolling and would like to keep this effect but since I have a Jquery library in my header already:

    Code:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
    Is it necessary to keep this:

    Code:
    <script src="http://www.google.com/jsapi" type="text/javascript"></script>
    <script type="text/javascript">
            google.load("jquery", "1.2.6");
        </script>
    ?
    when I remove that code, the smooth scrolling still works... so am I loading 2 jquery libraries by keeping that code?

    FYI: The code for the example.js file:

    Code:
    $(function(){
    
        $('a[href*=#]').click(function() {
        
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
            && location.hostname == this.hostname) {
            
                var $target = $(this.hash);
                
                $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
                
                if ($target.length) {
                
                    var targetOffset = $target.offset().top;
                    
                    $('html,body').animate({scrollTop: targetOffset}, 1000);
                        
                    return false;
                    
                }
                
            }
            
        });
        
    });
    Appreciate your help, thanks...

  2.  

  3. #2
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Yes, you're loading 2 libraries.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  4. #3
    Senior Member
    Join Date
    Mar 2010
    Posts
    104
    Member #
    21316
    Liked
    1 times
    Thanks dude! I guess that's all I need to know... don't wanna be loading an extra library do we!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:27 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com