you are in: codestackercodes [RSS]smooth scrolling with jquery

smooth scrolling with jquery Delicious Email

show/hide lines
   1  // Smooth scrolling within page anchors
   2  $('a[href*=#]').click(function() {
   3      
   4    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
   5          
   6          var $target = $(this.hash);
   7              
   8          $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
   9              
  10          if ($target.length) {
  11                var targetOffset = $target.offset().top;
  12                $('html,body').animate({scrollTop: targetOffset}, 1000);
  13                return false;       
  14          }      
  15       }        
  16  });
created by leozera — 17 May 2010 — get a short url — tags: javascript jquery embed

Comments



We dont send spam :)

If checked, it's highlights your comment
simple_captcha.jpg
Are you a human? Type the code from the image