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,23 +9,23 @@ $(function() {
9 function lazyThreshold() { 9 function lazyThreshold() {
10 $.each($('img.artbox-lazy-threshold'), function(index, value) { 10 $.each($('img.artbox-lazy-threshold'), function(index, value) {
11 var threshold = 200; 11 var threshold = 200;
12 - var attribute = $(value).attr('data-threshold'); 12 + var attribute = $(value).data('threshold');
13 if(attribute) { 13 if(attribute) {
14 threshold = attribute; 14 threshold = attribute;
15 } 15 }
16 - this.lazyload({ 16 + $(value).lazyload({
17 threshold: threshold 17 threshold: threshold
18 }); 18 });
19 }); 19 });
20 } 20 }
21 function lazyEvent() { 21 function lazyEvent() {
22 $.each($('img.artbox-lazy-event'), function(index, value) { 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 if(attribute) { 25 if(attribute) {
26 event = attribute; 26 event = attribute;
27 } 27 }
28 - this.lazyload({ 28 + $(value).lazyload({
29 event: event 29 event: event
30 }); 30 });
31 }); 31 });
@@ -33,11 +33,11 @@ function lazyEvent() { @@ -33,11 +33,11 @@ function lazyEvent() {
33 function lazyEffect() { 33 function lazyEffect() {
34 $.each($('img.artbox-lazy-effect'), function(index, value) { 34 $.each($('img.artbox-lazy-effect'), function(index, value) {
35 var effect = 'fadeIn'; 35 var effect = 'fadeIn';
36 - var attribute = $(value).attr('data-effect'); 36 + var attribute = $(value).data('effect');
37 if(attribute) { 37 if(attribute) {
38 effect = attribute; 38 effect = attribute;
39 } 39 }
40 - this.lazyload({ 40 + $(value).lazyload({
41 effect: effect 41 effect: effect
42 }); 42 });
43 }); 43 });