Skip to content

Commit bef9784

Browse files
committed
fix issue ressio#17
1 parent 2408f26 commit bef9784

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/jquery.lazyloadxt.bg.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
options.selector += ',[' + bgAttr + ']';
1111

1212
$(document).on('lazyshow', function (e) {
13-
var $this = $(e.target);
14-
$this
15-
.css('background-image', "url('" + $this.attr(bgAttr) + "')")
16-
.removeAttr(bgAttr);
13+
var $this = $(e.target),
14+
url = $this.attr(bgAttr);
15+
if (!!url) {
16+
$this
17+
.css('background-image', "url('" + url + "')")
18+
.removeAttr(bgAttr);
19+
}
1720
});
1821

1922
})(window.jQuery || window.Zepto || window.$);

0 commit comments

Comments
 (0)