0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-17 09:52:29 +01:00

Merge branch '2.0-wip' of github.com:twitter/bootstrap into 2.0-wip

This commit is contained in:
Mark Otto 2012-01-24 17:14:34 -08:00
commit 4793a6f8fa
2 changed files with 27 additions and 0 deletions

View File

@ -165,6 +165,12 @@ section {
border-right: 0;
}
.subhead .subnav-fixed {
position: fixed;
top: 40px;
z-index:1000;
}
/* Quick links
-------------------------------------------------- */

View File

@ -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