/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$('a[href=#target]'). click(function(){ var target = $('a[name=target]'); if (target.length) { var top = target.offset().top; $('html,body').animate({scrollTop: top}, 1000); return false; } });
URL: http://stackoverflow.com/questions/68165/javascript-to-scroll-long-page-to-div