Skip to content

Commit 06ba040

Browse files
committed
cache jquery obj in bindloader
1 parent 0ddac2b commit 06ba040

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

jquery.laziestloader.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,17 @@
105105

106106
function bindLoader() {
107107
$elements.one('laziestloader', function() {
108+
var $el = $(this);
108109
var source;
109110

110111
// set height?
111-
if ($(this).data().ratio) {
112+
if ($el.data().ratio) {
112113
setHeight.call(this);
113114
}
114115

115116
// set content. default: set element source
116117
if (options.setSourceMode) {
117-
source = options.getSource($(this));
118+
source = options.getSource($el);
118119
if (source && this.getAttribute('src') !== source) {
119120
this.setAttribute('src', source);
120121
if (typeof callback === 'function') callback.call(this);
@@ -124,7 +125,7 @@
124125
}
125126

126127
// reflect current state in classes
127-
$(this).addClass('ll-loaded').removeClass('ll-notloaded');
128+
$el.addClass('ll-loaded').removeClass('ll-notloaded');
128129
});
129130
}
130131

0 commit comments

Comments
 (0)