Advertisement
Guest User

Untitled

a guest
Oct 27th, 2012
1,469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function smoothInlineScroll() {
  2.     $("nav #menu a").bind('click', function(e) {
  3.         isScrolling = true;
  4.         var id      = $(this).attr('href').substr(1);
  5.         var index;
  6.  
  7.         //TODO: Create a function for this
  8.         $.each(section, function(key, val) {
  9.             if(val['id'] == id) {
  10.                 index = key;
  11.                 return;
  12.             }
  13.         });
  14.  
  15.         $("body").animate({scrollTop: section[index].staticOffset - headerHeight}, 1000, animationType, function() {
  16.             isScrolling    = false;
  17.             currentSection = index;
  18.         });
  19.  
  20.        
  21.         e.preventDefault();
  22.     });
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement