使用该函数,必须集成于jquery包
原理:当浏览器移动到某个指定位置时,该图层上浮,然后加入一个样式,让该div层定位于浏览器顶部
//控制头部购物车的显示
function fixshow(min_height){
min_height ? min_height = min_height : min_height = 830;
$(window).scroll(function(){
var s = $(window).scrollTop();
if( s > min_height){
$(\"#proBuyTip\").fadeIn(100);
$(\".fixtabwrap\").addClass(\"topfixed\");
}else{
$(\"#proBuyTip\").fadeOut(200);
$(\".fixtabwrap\").removeClass(\"topfixed\");
};
});
};
.topfixed {
position: fixed !important;
top: 0px;
left: 0px;
z-index: 999;
width: 100%;
background-color: white;
position: absolute;
_top: expression(eval(document.documentElement.scrollTop));
}
本文地址:https://www.stayed.cn/item/21836
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我