Skip to content

Instantly share code, notes, and snippets.

@lorddarq
lorddarq / scrollToElement.js
Created October 9, 2012 08:25
function to scroll to a specific element in the page
//replace #fromA with your button/control and #toB with the target to which you wanna scroll to.
$("#fromA").click(function() {
$("html, body").animate({ scrollTop: $("#toB").offset().top }, 1500);
console.log('executed scrollToElement');
return true;
});