How do I make easy scrolling with jquery?

Discussion in 'Software' started by AMark, Sep 9, 2010.

  1. AMark

    AMark Private E-2

    Hello!

    I am new to javascript but, I am trying to add jquery easing plug-in to my site.
    The problem that I am having is that it is not working for me.
    I am not sure if it is in the function itself or in how I am calling the javascript.
    Any help would be greatly appreciated.
    Thank you.

    Here is the code that I have in the head of the page:

    <!--jquery easing-->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery.easing.1.3.2.js"></script>

    <!--lightbox-->
    <script type="text/javascript" src="js/prototype.js"></script>
    <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
    <script type="text/javascript" src="js/lightbox.js"></script>






    <script>
    $(function() {
    // catch all clicks on a tag
    $("a").click(function() {
    // check if has hash
    if(this.hash) {
    // get rid og # sign
    var hash = this.hash.substr(1);
    // get the position of <a name>
    var $toElement = $("a[name="+hash+"]");
    var toPosition = $toElement.position().top;
    // scroll/animate to that element
    $("body,html").animate({
    scrollTop : toPosition
    },2000,"easeOutExpo");
    // don't do the jump
    return false;
    }
    });
    if(location.hash) {
    var hash = location.hash;
    window.scroll(0,0);
    $("a[href="+hash+"]").click();
    }
    });

    </script>
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds