scrollTo function jQuery is not working

Matt Andrzejczuk picture Matt Andrzejczuk · Sep 12, 2013 · Viewed 58.9k times · Source

I need Jquery's scrollTo function to work for this website: http://cinicraft.com/Silverman/index.html

I've tried the following

$(document).ready(function()
{
    $("div.btnLp3").click(function(){
        $('body,html').scrollTo('#target-examples', 800, {easing:'elasout'});
    });
});

And I've tried this too:

$(document).ready(function()
{
    $("div.btnLp3").click(function(){
        $('html, body').animate({ scrollTop: $(window.location.hash).offset().top}, 1000);
    });
});

I can't seem to get scrollTo working at all. Does anyone have any ideas? Here's what I have imported:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">  </script>    
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js">  </script>

Answer

Khawer Zeshan picture Khawer Zeshan · Sep 12, 2013

Try this

$("#clickme").click(function() {
    $('html, body').animate({
        scrollTop: $("#wrap2").offset().top
    }, 2000);
    return false;
});

FIDDLE