Commit f6b86bc1b82fe410c925530753e0bcb5ad50ab2f

Authored by Yarik
1 parent 4defc656

Lazyload

Showing 1 changed file with 7 additions and 7 deletions   Show diff stats
resources/artbox-lazy.js
... ... @@ -9,23 +9,23 @@ $(function() {
9 9 function lazyThreshold() {
10 10 $.each($('img.artbox-lazy-threshold'), function(index, value) {
11 11 var threshold = 200;
12   - var attribute = $(value).attr('data-threshold');
  12 + var attribute = $(value).data('threshold');
13 13 if(attribute) {
14 14 threshold = attribute;
15 15 }
16   - this.lazyload({
  16 + $(value).lazyload({
17 17 threshold: threshold
18 18 });
19 19 });
20 20 }
21 21 function lazyEvent() {
22 22 $.each($('img.artbox-lazy-event'), function(index, value) {
23   - var event = 'click';
24   - var attribute = $(value).attr('data-event');
  23 + var event = 'lazy.artbox';
  24 + var attribute = $(value).data('event');
25 25 if(attribute) {
26 26 event = attribute;
27 27 }
28   - this.lazyload({
  28 + $(value).lazyload({
29 29 event: event
30 30 });
31 31 });
... ... @@ -33,11 +33,11 @@ function lazyEvent() {
33 33 function lazyEffect() {
34 34 $.each($('img.artbox-lazy-effect'), function(index, value) {
35 35 var effect = 'fadeIn';
36   - var attribute = $(value).attr('data-effect');
  36 + var attribute = $(value).data('effect');
37 37 if(attribute) {
38 38 effect = attribute;
39 39 }
40   - this.lazyload({
  40 + $(value).lazyload({
41 41 effect: effect
42 42 });
43 43 });
... ...