-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscrollLoad.js
More file actions
35 lines (34 loc) · 1.03 KB
/
scrollLoad.js
File metadata and controls
35 lines (34 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
!(function(factory) {
if (typeof define === "function" && (define.amd || define.cmd) && !jQuery) {
define(["jquery"], factory);
} else if (typeof module === "object" && module.exports) {
module.exports = function(root, jQuery) {
if (jQuery === undefined) {
if (typeof window !== "undefined") {
jQuery = require("jquery");
} else {
jQuery = require("jquery")(root);
}
}
factory(jQuery);
return jQuery;
};
} else {
factory(jQuery);
}
})(function($) {
$.fn.scrollLoad = function(load, opt) {
return this.each(function() {
var $this = $(this);
var oWrap = $this.get(0);
$this.on("scroll", function() {
if (
oWrap.scrollHeight - oWrap.scrollTop ===
oWrap.clientHeight
) {
load();
}
});
});
};
});