html 微博下拉菜单,jQuery实现模仿微博下拉滚动条加载数据效果
本文實例講述了jQuery實現(xiàn)模仿微博下拉滾動條加載數(shù)據(jù)效果。分享給大家供大家參考,具體如下:
滾動條距離底部$(function () {
var i = 4;
$(window).bind("scroll", function (event) {
//滾動條到網(wǎng)頁頭部的 高度,兼容ie,ff,chrome
var top = document.documentElement.scrollTop + document.body.scrollTop;
//網(wǎng)頁的高度
var textheight = $(document).height();
// 網(wǎng)頁高度-top-當(dāng)前窗口高度
if (textheight - top - $(window).height() <= 100) {
if (i >= 100) {
return; //控制最大只能加載到100
}
$('#div1').css("height", $(document).height() + 100);
i++;
//可以根據(jù)實際情況,獲取動態(tài)數(shù)據(jù)加載 到 div1中
$('
' + i + '').appendTo($('#div1'));}
});
})
#div1 div{ font-size:100px; background:#ccc;margin-top:5px}
1
2
3
4
希望本文所述對大家jQuery程序設(shè)計有所幫助。
總結(jié)
以上是生活随笔為你收集整理的html 微博下拉菜单,jQuery实现模仿微博下拉滚动条加载数据效果的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 不孕不育输卵管堵塞粘连怎治疗
- 下一篇: yii html 添加下拉框,php