web前端开发避免不了的一些固定位置特效,自己写了一个留着备用,兼容id6-10
function fixed($id, $top) {
$top = $top == "" ? 0 : $top;
if ($.browser.msie && $.browser.version == "6.0") {
$($id).css( {
"position" : "absolute"
});
$(window).scroll(function() {
var $kfh = document.documentElement.scrollTop + $top + "px";
$($id).css("top", $kfh)
})
} else {
$($id).css( {
"position" : "fixed"
})
}
}
本文由 kevin 创作,采用 知识共享署名4.0 国际许可协议进行许可。
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名。