有没有什么办法可以让滚动的绿色div将黑色导航推到页面上,而不是滚动到页面顶部?
这是我的例子,向下滚动页面,横幅将淡出并滚动:
添加了Jquery:
jQuery(function($) {
function scrollBanner() {
//Get the scoll position of the page
scrollPos = jQuery(this).scrollTop();
//Scroll and fade out the banner text
jQuery('.hero-unit').css({
'margin-top' : -(scrollPos/3)+"px",
'opacity' : 1-(scrollPos/300)
});
//Scroll the background of the banner
jQuery('.fade').css({
'background-position' : 'center ' + (-scrollPos/8)+"px"
});
}
jQuery(window).scroll(function() {
scrollBanner();
});`我想要和这个网站一样的效果:
发布于 2013-02-06 19:18:33
也许你也可以将div.navbar-fixed-top添加到滚动行为中?和.hero-unit在一起。所以它们会以相同的“速率”移动
https://stackoverflow.com/questions/14727145
复制相似问题