Posted By

tclancy on 09/22/08


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

blackabee


jQuery Scroll Element


 / Published in: JavaScript
 

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

  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. });

Report this snippet  

You need to login to post a comment.