欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery頁(yè)面滾動(dòng)浮動(dòng)層智能定位實(shí)例代碼

 更新時(shí)間:2011年08月23日 23:23:26   作者:  
jQuery頁(yè)面滾動(dòng)浮動(dòng)層智能定位實(shí)例代碼,需要的朋友可以參考下。
HTML代碼:
復(fù)制代碼 代碼如下:

<div class="float" id="float">
我是個(gè)靦腆羞澀的浮動(dòng)層...
</div>

JS代碼:
復(fù)制代碼 代碼如下:

$.fn.smartFloat = function() {
var position = function(element) {
var top = element.position().top, pos = element.css("position");
$(window).scroll(function() {
var scrolls = $(this).scrollTop();
if (scrolls > top) {
if (window.XMLHttpRequest) {
element.css({
position: "fixed",
top: 0
});
} else {
element.css({
top: scrolls
});
}
}else {
element.css({
position: "absolute",
top: top
});
}
});
};
return $(this).each(function() {
position($(this));
});
};
//綁定
$("#float").smartFloat();

相關(guān)文章

最新評(píng)論