類似天貓商品詳情隨瀏覽器移動(dòng)的示例代碼
更新時(shí)間:2014年02月27日 14:47:22 作者:
當(dāng)瀏覽器移動(dòng)到某個(gè)指定位置時(shí),該圖層上浮,然后加入一個(gè)樣式,讓該div層定位于瀏覽器頂部,需要的朋友可以參考下
使用該函數(shù),必須集成于jquery包
原理:當(dāng)瀏覽器移動(dòng)到某個(gè)指定位置時(shí),該圖層上浮,然后加入一個(gè)樣式,讓該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));
}
原理:當(dāng)瀏覽器移動(dòng)到某個(gè)指定位置時(shí),該圖層上浮,然后加入一個(gè)樣式,讓該div層定位于瀏覽器頂部
復(fù)制代碼 代碼如下:
//控制頭部購物車的顯示
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");
};
});
};
復(fù)制代碼 代碼如下:
.topfixed {
position: fixed !important;
top: 0px;
left: 0px;
z-index: 999;
width: 100%;
background-color: white;
position: absolute;
_top: expression(eval(document.documentElement.scrollTop));
}
您可能感興趣的文章:
- Android仿淘寶商品瀏覽界面圖片滾動(dòng)效果
- Jquery 最近瀏覽過的商品的功能實(shí)現(xiàn)代碼
- Android時(shí)光軸實(shí)現(xiàn)淘寶物流信息瀏覽效果
- PHP實(shí)現(xiàn)采集抓取淘寶網(wǎng)單個(gè)商品信息
- JQuery實(shí)現(xiàn)的購物車功能(可以減少或者添加商品并自動(dòng)計(jì)算價(jià)格)
- PHP 類商品秒殺計(jì)時(shí)實(shí)現(xiàn)代碼
- asp.net下使用jQuery.AutoComplete完成仿淘寶商品搜索自動(dòng)完成功能(改進(jìn)了鍵盤上下選擇體驗(yàn))
- 基于jquery的商品展示放大鏡
- 仿當(dāng)當(dāng)網(wǎng)淘寶網(wǎng)等主流電子商務(wù)網(wǎng)站商品分類導(dǎo)航菜單
- JAVAEE model1模型實(shí)現(xiàn)商品瀏覽記錄(去除重復(fù)的瀏覽記錄)(一)
相關(guān)文章
jQuery AJAX 調(diào)用WebService實(shí)現(xiàn)代碼
用jQuery調(diào)用其他項(xiàng)目的WebService的代碼,需要的朋友可以參考下。2010-03-03
jQuery自定義元素右鍵點(diǎn)擊事件(實(shí)現(xiàn)案例)
下面小編就為大家?guī)硪黄猨Query自定義元素右鍵點(diǎn)擊事件(實(shí)現(xiàn)案例)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-04-04

