var RoomList = function(ajaxData,append_el,load_state_el,dropload){ if(dropload){ var _self = this; $(window).on('scroll',function(){ clearTimeout(this.timer); this.timer = setTimeout(function(){ var scrollTop = $(this).scrollTop(); var scrollHeight = $(document).height(); var windowHeight = $(this).height(); if(scrollTop + windowHeight == scrollHeight){ _self.getData(); } },500); }); } this.append_el = append_el; this.load_state_el = load_state_el; this.curpage = 1; this.hasmore = true; this.init = function (callback) { this.getData(callback); }; this.droploadCallback = function(res){}; this.getData = function(callback){ var _self = this; if(!_self.hasmore) return; $.showLoading(); $.get("/mobile/index.php", { act: ajaxData.act, op: ajaxData.op, room_id: getHrefArguments("talk_id"), client_type: "ajax", curpage: _self.curpage }, function (res) { $.hideLoading(); _self.droploadCallback(res); if(typeof callback == "function") { callback(); } }); } }; var RoomListHTML = function(useObj,datas){ this.useObj = useObj; this.listDatas = datas; this.endHTML = function(id){ var endHTML = "
\n" + " 我是有底线的\n" + "
"; $(id).empty().append(endHTML); }; this.loadHTML = function(id){ var loadHTML = "
\n" + " \n" + " 正在加载\n" + "
"; $(id).empty().append(loadHTML); }; };