您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

类似天猫商品详情随浏览器移动的示例代码_jquery

2025/10/29 18:08:55发布17次查看
使用该函数,必须集成于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));
}
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product