mirror of https://github.com/layui/layui
commit
de47b48301
|
@ -22,7 +22,7 @@ layui.define('jquery', function(exports){
|
|||
var end = options.end || '没有更多了'; //“末页”显示文案
|
||||
|
||||
//滚动条所在元素是否为document
|
||||
var notDocment = options.scrollElem && options.scrollElem !== document;
|
||||
var notDocument = options.scrollElem && options.scrollElem !== document;
|
||||
|
||||
//加载更多
|
||||
var ELEM_TEXT = '<cite>加载更多</cite>'
|
||||
|
@ -77,10 +77,10 @@ layui.define('jquery', function(exports){
|
|||
|
||||
timer = setTimeout(function(){
|
||||
//计算滚动所在容器的可视高度
|
||||
var height = notDocment ? othis.height() : $(window).height();
|
||||
var height = notDocument ? othis.height() : $(window).height();
|
||||
|
||||
//计算滚动所在容器的实际高度
|
||||
var scrollHeight = notDocment
|
||||
var scrollHeight = notDocument
|
||||
? othis.prop('scrollHeight')
|
||||
: document.documentElement.scrollHeight;
|
||||
|
||||
|
@ -103,12 +103,12 @@ layui.define('jquery', function(exports){
|
|||
var elem = options.elem || 'img';
|
||||
|
||||
//滚动条所在元素是否为document
|
||||
var notDocment = options.scrollElem && options.scrollElem !== document;
|
||||
var notDocument = options.scrollElem && options.scrollElem !== document;
|
||||
|
||||
//显示图片
|
||||
var show = function(item, height){
|
||||
var start = scrollElem.scrollTop(), end = start + height;
|
||||
var elemTop = notDocment ? function(){
|
||||
var elemTop = notDocument ? function(){
|
||||
return item.offset().top - scrollElem.offset().top + start;
|
||||
}() : item.offset().top;
|
||||
|
||||
|
@ -132,7 +132,7 @@ layui.define('jquery', function(exports){
|
|||
}, render = function(othis, scroll){
|
||||
|
||||
//计算滚动所在容器的可视高度
|
||||
var height = notDocment ? (scroll||scrollElem).height() : $(window).height();
|
||||
var height = notDocument ? (scroll||scrollElem).height() : $(window).height();
|
||||
var start = scrollElem.scrollTop(), end = start + height;
|
||||
|
||||
that.lazyimg.elem = $(elem);
|
||||
|
@ -142,7 +142,7 @@ layui.define('jquery', function(exports){
|
|||
} else {
|
||||
//计算未加载过的图片
|
||||
for(var i = 0; i < that.lazyimg.elem.length; i++){
|
||||
var item = that.lazyimg.elem.eq(i), elemTop = notDocment ? function(){
|
||||
var item = that.lazyimg.elem.eq(i), elemTop = notDocument ? function(){
|
||||
return item.offset().top - scrollElem.offset().top + start;
|
||||
}() : item.offset().top;
|
||||
|
||||
|
|
|
@ -1072,7 +1072,7 @@
|
|||
|
||||
var that = this;
|
||||
var options = that.config;
|
||||
var timestrap = {}
|
||||
var timestamp = {}
|
||||
var dateTime = opts.index > (opts.time ? 0 : 41) ? that.endDate : options.dateTime;
|
||||
var isOut;
|
||||
|
||||
|
@ -1081,7 +1081,7 @@
|
|||
,min: options.min
|
||||
,max: options.max
|
||||
}, function(key, item){
|
||||
timestrap[key] = that.newDate(lay.extend({
|
||||
timestamp[key] = that.newDate(lay.extend({
|
||||
year: item.year
|
||||
,month: opts.type === 'year' ? 0 : item.month // 年份的时候只比较年
|
||||
,date: (opts.type === 'year' || opts.type === 'month') ? 1 : item.date // 年月只比较年月不与最大最小比日期
|
||||
|
@ -1094,7 +1094,7 @@
|
|||
}())).getTime(); //time:是否比较时分秒
|
||||
});
|
||||
|
||||
isOut = timestrap.now < timestrap.min || timestrap.now > timestrap.max;
|
||||
isOut = timestamp.now < timestamp.min || timestamp.now > timestamp.max;
|
||||
opts.elem && opts.elem[isOut ? 'addClass' : 'removeClass'](DISABLED);
|
||||
|
||||
return isOut;
|
||||
|
|
Loading…
Reference in New Issue