源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2021-06-28 15:11 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:类似天猫商品详情随浏览器移动的示例代码
使用该函数,必须集成于jquery包 原理:当浏览器移动到某个指定位置时,该图层上浮,然后加入一个样式,让该div层定位于浏览器顶部
[u]复制代码[/u] 代码如下:
//控制头部购物车的显示 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"); }; }); };
[u]复制代码[/u] 代码如下:
.topfixed { position: fixed !important; top: 0px; left: 0px; z-index: 999; width: 100%; background-color: white; position: absolute; _top: expression(eval(document.documentElement.scrollTop)); }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部