Advertisement
livechatinc

CustomAnimationScrollTo

Oct 15th, 2015
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Scroll To Animation
  2. //-------------------------------------------------------------------------------
  3.  
  4. var customScrollToAnimation = $(".scroll-to");
  5.  
  6. customScrollToAnimation.click( function(event) {
  7.   $('.modal').modal('hide');
  8.   var position = $(document).scrollTop();
  9.   var scrollOffset = 260;
  10.  
  11.   if(position > 39)
  12.   {
  13.     scrollOffset = 114;
  14.   }
  15.  
  16.   var marker = $(this).attr('href');
  17.   $('html, body').animate({ scrollTop: $(marker).offset().top - scrollOffset}, 'slow');
  18.   return false;
  19. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement