Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery scrollTo [closed]

$(document).ready(function() {
    $("#contact_menu").click(function() {
        $(body).scrollTo("#contact", 800);  
    }); 
}); 

I typed this in my code, hoped it would make my page scroll, but I won't work. I tried several ways, but I can't get it right.

I hope one of you can help me.

like image 457
Johan Avatar asked Aug 30 '26 09:08

Johan


1 Answers

Try this:

$("#contact_menu").click(function() {
        $("body").animate({
         scrollTop: $("#contact").offset().top
     }, 2000);
}); 

jsFiddle: http://jsfiddle.net/hescano/43umh/

Were you trying this plugin? http://demos.flesler.com/jquery/scrollTo/

like image 122
Hanlet Escaño Avatar answered Sep 01 '26 00:09

Hanlet Escaño