我想要达到的目标与此相似:http://www.thoughtspot.com/
我快到了!我无法复制的是导航在向上滚动时具有透明背景然后消失的方式。
有人可以帮我吗?
function hasScrolled() {
var st = $(this).scrollTop();
// Make sure they scroll more than delta
if(Math.abs(lastScrollTop - st) <= delta)
return;
// If they scrolled down and are past the navbar, add class .nav-up.
// This is necessary so you never see what is "behind" the navbar.
if (st > lastScrollTop && st > navbarHeight){
// Scroll Down
$('header').removeClass('nav-down').addClass('nav-up');
} else {
// Scroll Up
if(st + $(window).height() < $(document).height()) {
$('header').removeClass('nav-up').addClass('nav-down');
}
}
lastScrollTop = st;
}
有关完整代码,请查看我创建的jsfiddle:
http://jsfiddle.net/s6mLJ/2257/
谢谢大家!
答案 0 :(得分:0)