diff --git a/docs/assets/css/docs.css b/docs/assets/css/docs.css index 956eff246d..d5192ca553 100644 --- a/docs/assets/css/docs.css +++ b/docs/assets/css/docs.css @@ -165,6 +165,12 @@ section { border-right: 0; } +.subhead .subnav-fixed { + position: fixed; + top: 40px; + z-index:1000; +} + /* Quick links -------------------------------------------------- */ diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index 95caa0f31a..4b7efe53fc 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -116,6 +116,27 @@ $(function(){ }) }) + // fix sub nav playa + var $win = $(window) + , $nav = $('.subhead .nav') + , navTop = $('.subhead .nav').offset().top - 40 + , isFixed = 0 + + processScroll() + + $win.on('scroll', processScroll) + + function processScroll() { + var i, scrollTop = $win.scrollTop() + if (scrollTop >= navTop && !isFixed) { + isFixed = 1 + $nav.addClass('subnav-fixed') + } else if (scrollTop <= navTop && isFixed) { + isFixed = 0 + $nav.removeClass('subnav-fixed') + } + } + }) // JS for javascript demos