Posted By

mortu on 12/09/11


Tagged

plugin without a scrollto


Versions (?)

scrollTo jQuery


 / Published in: jQuery
 

scrollTo jQuery

  1. $(document).ready(function(){
  2. $('a[href*=#]').click(function() {
  3. if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
  4. && location.hostname == this.hostname) {
  5. var $target = $(this.hash);
  6. $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
  7. if ($target.length) {
  8. var targetOffset = $target.offset().top;
  9. $('html,body').animate({
  10. scrollTop: targetOffset
  11. }, 1000);
  12. return false;
  13. }
  14. }
  15. });
  16. });

Report this snippet  

You need to login to post a comment.