Advertisement
sastranababan

smooth scrooling

Mar 12th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // smooth scrooling
  2.  
  3. $('.smooth_scrooling').click(function() {
  4.      if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
  5.       var target = $(this.hash);
  6.       target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
  7.       if (target.length) {
  8.         $('html,body').animate({
  9.           scrollTop: target.offset().top
  10.         }, 1000);
  11.         return false;
  12.       }
  13.     }
  14.   });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement