jQuery Scroll Element


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $('a[href=#target]').
  2. click(function(){
  3. var target = $('a[name=target]');
  4. if (target.length)
  5. {
  6. var top = target.offset().top;
  7. $('html,body').animate({scrollTop: top}, 1000);
  8. return false;
  9. }
  10. });

URL: http://stackoverflow.com/questions/68165/javascript-to-scroll-long-page-to-div

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.