diff options
author | Thomas Park <thomas@thomaspark.me> | 2013-08-06 15:15:37 -0400 |
---|---|---|
committer | Thomas Park <thomas@thomaspark.me> | 2013-08-06 15:15:37 -0400 |
commit | 55f9c2cec0e48dc5190a1f81f297e469c2d5015b (patch) | |
tree | c6c9730b102c7d1239cf143c0ffd9d9de6a8d088 /2/js/bootswatch.js | |
parent | a25e04ec97d3d08fb722a167f07150d9af9f1229 (diff) |
moves v2.3.2 to /2/
Diffstat (limited to '2/js/bootswatch.js')
-rw-r--r-- | 2/js/bootswatch.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/2/js/bootswatch.js b/2/js/bootswatch.js new file mode 100644 index 00000000..5a9b3002 --- /dev/null +++ b/2/js/bootswatch.js @@ -0,0 +1,43 @@ +$('a[rel=tooltip]').tooltip({ + 'placement': 'bottom' +}); + + +$('.navbar a, .subnav a').smoothScroll(); + + +(function ($) { + + $(function(){ + + // fix sub nav on scroll + var $win = $(window), + $body = $('body'), + $nav = $('.subnav'), + navHeight = $('.navbar').first().height(), + subnavHeight = $('.subnav').first().height(), + subnavTop = $('.subnav').length && $('.subnav').offset().top - navHeight, + marginTop = parseInt($body.css('margin-top'), 10); + isFixed = 0; + + processScroll(); + + $win.on('scroll', processScroll); + + function processScroll() { + var i, scrollTop = $win.scrollTop(); + + if (scrollTop >= subnavTop && !isFixed) { + isFixed = 1; + $nav.addClass('subnav-fixed'); + $body.css('margin-top', marginTop + subnavHeight + 'px'); + } else if (scrollTop <= subnavTop && isFixed) { + isFixed = 0; + $nav.removeClass('subnav-fixed'); + $body.css('margin-top', marginTop + 'px'); + } + } + + }); + +})(window.jQuery);
\ No newline at end of file |