mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-28 14:29:07 +02:00
some progress on affix plugin
This commit is contained in:
@@ -43,32 +43,6 @@
|
||||
})
|
||||
}
|
||||
|
||||
// fix sub nav on scroll
|
||||
var $win = $(window)
|
||||
, $nav = $('.subhead .navbar-subnav')
|
||||
, navTop = $('.subhead .navbar-subnav').length && $('.subhead .navbar-subnav').offset().top - 40
|
||||
, isFixed = 0
|
||||
|
||||
processScroll()
|
||||
|
||||
// hack sad times - holdover until rewrite for 2.1
|
||||
$nav.on('click', function () {
|
||||
if (!isFixed) setTimeout(function () { $win.scrollTop($win.scrollTop() - 47) }, 10)
|
||||
})
|
||||
|
||||
$win.on('scroll', processScroll)
|
||||
|
||||
function processScroll() {
|
||||
var i, scrollTop = $win.scrollTop()
|
||||
if (scrollTop >= navTop && !isFixed) {
|
||||
isFixed = 1
|
||||
$nav.addClass('navbar-subnav-fixed')
|
||||
} else if (scrollTop <= navTop && isFixed) {
|
||||
isFixed = 0
|
||||
$nav.removeClass('navbar-subnav-fixed')
|
||||
}
|
||||
}
|
||||
|
||||
// tooltip demo
|
||||
$('.tooltip-demo').tooltip({
|
||||
selector: "a[rel=tooltip]"
|
||||
|
Reference in New Issue
Block a user