标签:加载 sel win var 数据 return his scrolltop function
var $doc, $win, bind;
$doc = $(document);
$win = $(window);
bind = function() {
return $(‘.js-scroll-load‘).each(function() {
var $self, scroll, top;
$self = $(this);
$self.removeClass(‘js-scroll-load‘);
top = $self.offset().top - 300;
$win.on(‘scroll‘, scroll = function() {
if ($doc.scrollTop() + $win.height() > top) {
$self.click();
return $win.off(‘scroll‘, scroll);
}
});
return scroll();
});
};
$(bind);
标签:加载 sel win var 数据 return his scrolltop function
原文地址:http://www.cnblogs.com/zslslir/p/6762690.html