Blame view

resources/artbox-lazy.js 1.07 KB
a6322189   Yarik   Lazyload
1
  $(function() {
4defc656   Yarik   Lazyload
2
3
4
      $('img.artbox-lazy').lazyload({
          skip_invisible: false
      });
a6322189   Yarik   Lazyload
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
36
37
38
39
40
41
42
43
44
      lazyThreshold();
      lazyEvent();
      lazyEffect();
  });
  function lazyThreshold() {
      $.each($('img.artbox-lazy-threshold'), function(index, value) {
          var threshold = 200;
          var attribute = $(value).attr('data-threshold');
          if(attribute) {
              threshold = attribute;
          }
          this.lazyload({
              threshold: threshold
          });
      });
  }
  function lazyEvent() {
      $.each($('img.artbox-lazy-event'), function(index, value) {
          var event = 'click';
          var attribute = $(value).attr('data-event');
          if(attribute) {
              event = attribute;
          }
          this.lazyload({
              event: event
          });
      });
  }
  function lazyEffect() {
      $.each($('img.artbox-lazy-effect'), function(index, value) {
          var effect = 'fadeIn';
          var attribute = $(value).attr('data-effect');
          if(attribute) {
              effect = attribute;
          }
          this.lazyload({
              effect: effect
          });
      });
  }