Azeem Haider Azeem Haider - 1 year ago 170
HTML Question

need java script for smooth scroll down

I have navigation bar working with css id.
When i click on button it suddenly took me to that id.
I want a smooth scroll to that id. How it is possible.
Please help me.

Answer Source

With jQuery you can simply use the animate function


$('html, body').animate({
    scrollTop: $('#button_id').offset().top // scroll down to button
  }, 500); // scrolls smoothly in 500 milliseconds
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download