hal02q
Last Updated: February 25, 2016
·
3.095K
· aalaap
Aalaap filter 512

Smooth scrolling without a jQuery plugin

jQuery plugins for smooth scrolling are great and offer lots of customization, but sometimes you just need basic, simple, to-the-point smooth scrolling. Why should that require a bulky plugin? Well, it doesn't. You can actually get a functional smooth scroll with just one line of jQuery!

$('html, body').animate({
    scrollTop: $("#elementID").offset().top
}, 2000);

Well, one line if you don't count the newlines!

Via A Beautiful Site

Say Thanks
Respond