forked from shprink/BttrLazyLoading
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
1053 lines (1039 loc) · 54.8 KB
/
index.php
1
2
3
4
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<title>Responsive Lazy Loading plugin for JQuery | BttrLazyLoading</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="BttrLazyLoading is a Jquery plugin that allows your web application to only load images within the viewport. It also allows you to have different version of an image for 4 differents screen sizes.">
<meta name="keywords" content="JavaScript, Responsive, image, images, jQuery, coffeescript, lazy loading">
<meta name="author" content="Julien Renaux">
<meta property="og:title" content="Responsive Lazy Loading plugin for JQuery | BttrLazyLoading"/>
<meta property="og:description" content="BttrLazyLoading is a Jquery plugin that allows your web application to only load images within the viewport. It also allows you to have different version of an image for 4 differents screen sizes."/>
<meta property="og:url" content="http://bttrlazyloading.julienrenaux.fr"/>
<meta property="og:site_name" content="Julien Renaux Blog"/>
<meta property="og:type" content="blog"/>
<meta property="og:image" content="http://julienrenaux.fr/wp-content/uploads/2013/12/bttrlazyloading-300x181.png">
<link rel="stylesheet" type="text/css" href="bower_components/bootswatch/yeti/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="bower_components/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="bower_components/highlight.js/src/styles/solarized_dark.css" />
<link rel="stylesheet" type="text/css" href="bttrlazyloading.min.css" />
<script src="bower_components/jquery/jquery.min.js"></script>
<script src="bower_components/jquery.smooth-scroll/jquery.smooth-scroll.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="demo/js/highlight.pack.js"></script>
<script src="jquery.bttrlazyloading.min.js"></script>
<style>
body{
margin-top: 46px;
}
#back-to-top{
font-size: 30px;
position: fixed;
bottom: 20px;
right: 20px;
cursor: pointer;
}
.panel-heading h3{
margin: 0px;
}
.panel-heading .pull-right{
margin-top: 4px;
}
.navbar.affix {
position: fixed;
top: 0;
width: 100%;
}
.alert {
font-size: 15px;
font-weight: 500;
}
#option-container-wrapper{
height: 200px;
overflow: auto;
}
table{
table-layout: fixed;
}
.break-word{
word-wrap: break-word;
-ms-word-wrap: break-word;
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
.navbar-inverse .navbar-text{
color: white;
}
.panel-title{
font-size: 24px;
}
.img-thumbnail{
padding: 0px;
}
#facebook, #twitter, #github, #google-plus, #linkedin{
background-repeat: no-repeat;
width: 48px;
height: 48px;
display: block;
}
#facebook.loaded, #twitter.loaded, #github.loaded, #google-plus.loaded, #linkedin.loaded{
background-image: none;
width:150px;
height: 30px;
}
#facebook{
background-image: url('demo/img/facebook.png');
}
#twitter{
background-image: url('demo/img/twitter.png');
}
#github{
background-image: url('demo/img/github.png');
}
#google-plus{
background-image: url('demo/img/google-plus.png');
}
#linkedin{
background-image: url('demo/img/linkedin.png');
}
</style>
<script type="text/javascript">
$(function() {
$('#back-to-top').click(function(event) {
$.smoothScroll({
scrollTarget: 'body'
});
});
$('.smooth-scroll').click(function(event) {
event.preventDefault();
var link = this;
$.smoothScroll({
scrollTarget: link.hash,
offset: -60
});
});
// Set global options to use the same set of image within this page ;)
$.bttrlazyloading.setOptions({
xs: {
src: "demo/img/720x200.gif",
width: 720,
height: 200
},
sm: {
src: "demo/img/360x200.gif",
width: 360,
height: 200
},
md: {
src: "demo/img/470x200.gif",
width: 470,
height: 200
},
lg: {
src: "demo/img/570x200.gif",
width: 570,
height: 200
},
delay: 2000,
wrapperClasses: 'img-thumbnail',
triggermanually: true
});
hljs.initHighlightingOnLoad();
});
</script>
</head>
<body id="top">
<div id="fb-root"></div>
<script>
$(function() {
$('#facebook').mouseover(function(ev) {
$(this).addClass('loaded').off('mouseover');
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id))
return;
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=206488179525466";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
});
$('#twitter').mouseover(function(ev) {
$(this).addClass('loaded').off('mouseover');
!function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + '://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);
}
}(document, 'script', 'twitter-wjs');
});
$('#google-plus').mouseover(function(ev) {
$(this).addClass('loaded').off('mouseover');
(function() {
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
po.src = 'https://apis.google.com/js/platform.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
})();
});
});
</script>
<script></script>
<div class="container">
<br/>
<div class="row">
<div class="col-md-6 col-sm-6 col-lg-6">
<img id="img-not-bad" class="bttrlazyloading"
data-bttrlazyloading-xs-src="http://julienrenaux.fr/wp-content/uploads/2013/12/bttrlazyloading-710x428.png"
data-bttrlazyloading-xs-width="698"
data-bttrlazyloading-xs-height="421"
data-bttrlazyloading-sm-src="http://julienrenaux.fr/wp-content/uploads/2013/12/bttrlazyloading-710x428.png"
data-bttrlazyloading-sm-width="335"
data-bttrlazyloading-sm-height="202"
data-bttrlazyloading-md-src="http://julienrenaux.fr/wp-content/uploads/2013/12/bttrlazyloading-710x428.png"
data-bttrlazyloading-md-width="445"
data-bttrlazyloading-md-height="268"
data-bttrlazyloading-lg-src="http://julienrenaux.fr/wp-content/uploads/2013/12/bttrlazyloading-710x428.png"
data-bttrlazyloading-lg-width="545"
data-bttrlazyloading-lg-height="329"/>
<script type="text/javascript">
$(function() {
$('#img-not-bad').bttrlazyloading({
triggermanually: false,
animation: 'fadeInDown',
delay: 1000
});
});
</script>
</div>
<div class="col-md-6 col-sm-6 col-lg-6">
<h2 class="feature-heading break-word">BttrLazyLoading <span class="text-muted">Responsive Lazy Loading plugin for JQuery</span></h2>
<p class="lead">BttrLazyLoading is a Jquery plugin that allows your web application to only load images within the viewport. It also allows you to have different version of an image for 4 different screen sizes.</p>
<h4>Share!</h4>
<ul class="list-inline">
<li>
<div id="facebook" class="fb-like" data-href="http://bttrlazyloading.julienrenaux.fr/" data-width="150" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>
</li>
<li>
<div id="google-plus" class="g-plusone" data-size="tall" data-annotation="inline" data-width="150" data-href="http://bttrlazyloading.julienrenaux.fr"></div>
</li>
<li>
<a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-url="http://bttrlazyloading.julienrenaux.fr/" data-text="Responsive Lazy Loading plugin for JQuery." data-via="julienrenaux" data-size="large" data-hashtags="BttrLazyLoading"></a>
</li>
</ul>
</div>
</div>
<br/>
<div class="well text-center">
<a class="btn btn-primary btn-lg" target="_blank" title="Download" href="http://bit.ly/1iO1VTE">
<i class="fa fa-download"></i> v1.0.3 (< 7.5kB)
</a>
<a class="btn btn-info btn-lg" href="/demo" >
<i class="fa fa-play"></i> Demos
</a>
<a class="btn btn-default btn-lg" target="_blank" title="Download" href="https://github.com/shprink/BttrLazyLoading">
<i class="fa fa-github"></i> Project on Github
</a>
</div>
<div class="row">
<div class="col-md-6 col-sm-6 col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-spinner fa-spin"></i> Lazy loading</h3>
</div>
<div class="panel-body">
<p>BttrLazyLoading allows your Web application to defer image loading until images are scrolled to. That way the page loading time decreases considerably.</p>
</div>
</div>
</div>
<div class="col-md-6 col-sm-6 col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-mobile"></i> <i class="fa fa-tablet"></i> <i class="fa fa-desktop"></i> Responsivity</h3>
</div>
<div class="panel-body">
<p>BttrLazyLoading makes sure that you always have the appropriate image loaded for any type of screen: phones (<768px), tablets (≥768px), desktops (≥992px) and large Desktops (≥1200px).</p>
</div>
</div>
</div>
<div class="col-md-6 col-sm-6 col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-eye"></i> Retina ready</h3>
</div>
<div class="panel-body">
<p>BttrLazyLoading uses a naming convention <code>@2x</code> to display Retina images when the option is enabled.</p>
</div>
</div>
</div>
<div class="col-md-6 col-sm-6 col-lg-3">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-cogs"></i> Customizable</h3>
</div>
<div class="panel-body">
<p>With more than 10 options (such as animations or background color) and 4 events, BttrLazyLoading is fully customizable to adapt to most needs.</p>
</div>
</div>
</div>
</div>
<section id="options">
<div class="page-header">
<h2>Options</h2>
</div>
<p>Options can be set for one or several images at the same time or for the whole page at once (using the <a class="smooth-scroll" href="#global-method-setOptions">setOptions</a> global function)</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 200px;" class="hidden-xs">type</th>
<th style="width: 200px;" class="hidden-xs">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="#demo-delay" class="smooth-scroll">delay</a></td>
<td class="hidden-xs">integer</td>
<td class="hidden-xs">0</td>
<td><p>Adds delay to the image loading time.</p></td>
</tr>
<tr>
<td><a href="#demo-threshold" class="smooth-scroll">threshold</a></td>
<td class="hidden-xs">integer</td>
<td class="hidden-xs">0</td>
<td><p>By default images are loaded when they appear on the screen. If you want images to load earlier use threshold parameter. For instance setting a threshold to 200 end up loading the image 200 pixels before it appears on viewport.</p></td>
</tr>
<tr>
<td><a href="#demo-animation" class="smooth-scroll">animation</a></td>
<td class="hidden-xs">string</td>
<td class="hidden-xs">"bounceIn"</td>
<td><p>Adds an animation when the image appears. You have access to all of the following animations created by <a href="https://daneden.me/animate/" title="animate" target="_blank" >Animate.css</a> or use <code>Null</code> if you do not want any animation.</p>
<div>['flipInX', 'flipInY', 'fadeIn', 'fadeInUp', 'fadeInDown', 'fadeInLeft', 'fadeInRight', 'fadeInUpBig', 'fadeInDownBig', 'fadeInLeftBig', 'fadeInRightBig', 'slideInDown', 'slideInLeft', 'slideInRight', 'bounceIn', 'bounceInDown', 'bounceInUp', 'bounceInLeft', 'bounceInRight', 'rotateIn', 'rotateInDownLeft', 'rotateInDownRight', 'rotateInUpLeft', 'rotateInUpRight', 'lightSpeedIn', 'rollIn']</div></td>
</tr>
<tr>
<td><a href="#demo-event" class="smooth-scroll">event</a></td>
<td class="hidden-xs">string</td>
<td class="hidden-xs">"scroll"</td>
<td><p>Defines the event that will be used to trigger the image loading/update.</p></td>
</tr>
<tr>
<td><a href="#demo-placeholder" class="smooth-scroll">placeholder</a></td>
<td class="hidden-xs">string (image base64)</td>
<td class="hidden-xs">"data:image/gif;base64..."</td>
<td><p>Base64 image that is used when the image is loading.</p></td>
</tr>
<tr>
<td><a href="#demo-container" class="smooth-scroll">container</a></td>
<td class="hidden-xs">string (CSS selector)</td>
<td class="hidden-xs">window</td>
<td><p>You can also use this plugin for images inside scrolling container, such as <code>div</code> with scrollbar. By default the container is the window.</p></td>
</tr>
<tr>
<td><a href="#demo-retina" class="smooth-scroll">retina</a></td>
<td class="hidden-xs">boolean</td>
<td class="hidden-xs">false</td>
<td>
<p>Enables a better quality on Retina screens.</p>
<p>BttrLazyLoading uses a naming convention <code>@2x</code> to display Retina images. BttrLazyLoading will therefore seek <code>"[email protected]"</code> on Retina screens instead of <code>"yourImage.gif"</code></p>
</td>
</tr>
<tr>
<td><a href="#demo-triggermanually" class="smooth-scroll">triggermanually</a></td>
<td class="hidden-xs">boolean</td>
<td class="hidden-xs">false</td>
<td><p>Whether or not to trigger the first image loading manually.</p></td>
</tr>
<tr>
<td><a href="#demo-updatemanually" class="smooth-scroll">updatemanually</a></td>
<td class="hidden-xs">boolean</td>
<td class="hidden-xs">false</td>
<td><p>Whether or not to trigger the image update manually (needed when the window resizes for example).</p></td>
</tr>
<tr>
<td><a href="#demo-backgroundcolor" class="smooth-scroll">backgroundcolor</a></td>
<td class="hidden-xs">string</td>
<td class="hidden-xs">#EEE</td>
<td><p>Displays a background color before loading the image.</p></td>
</tr>
<tr>
<td>xs</td>
<td class="hidden-xs">object</td>
<td class="hidden-xs">
<pre><code class="javascript">{
src : null,
width : 100,
height : 100
}</pre></code>
</td>
<td><p>Image Object for Mobile</p></td>
</tr>
<tr>
<td>sm</td>
<td class="hidden-xs">object</td>
<td class="hidden-xs">
<pre><code class="javascript">{
src : null,
width : 100,
height : 100
}</pre></code>
</td>
<td><p>Image Object for Tablet</p></td>
</tr>
<tr>
<td>md</td>
<td class="hidden-xs">object</td>
<td class="hidden-xs">
<pre><code class="javascript">{
src : null,
width : 100,
height : 100
}</pre></code>
</td>
<td><p>Image Object for Desktop</p></td>
</tr>
<tr>
<td>lg</td>
<td class="hidden-xs">object</td>
<td class="hidden-xs">
<pre><code class="javascript">{
src : null,
width : 100,
height : 100
}</pre></code>
</td>
<td><p>Image Object for Large Desktop</p></td>
</tr>
</tbody>
</table>
<div class="alert alert-info">BttrLazyLoading options can be set in two different ways: using <a href="http://api.jquery.com/jQuery.data/" target="_blank">jQuery data</a> on the image element or directly on the instantiation.</div>
<h3>Set options using data attributes</h3>
<pre><code class="html"><img id="yourImageId" class="bttrlazyloading"
data-bttrlazyloading-xs-src="img/768x200.gif"
data-bttrlazyloading-sm-src="img/345x250.gif"
data-bttrlazyloading-md-src="img/455x350.gif"
data-bttrlazyloading-lg-src="img/360x300.gif"
data-bttrlazyloading-transition="rotatedIn"
data-bttrlazyloading-retina="true"
data-bttrlazyloading-delay="2000"
data-bttrlazyloading-event="mouseover"
data-bttrlazyloading-container="document.body"
data-bttrlazyloading-threshold="500"
data-bttrlazyloading-placeholder="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
/></pre></code>
<p>For an optimized user experience 'width' and 'height' are necessary (the plugin cannot know the dimensions of your images before they load).</p>
<pre><code class="html"><img id="yourImageId" class="bttrlazyloading"
data-bttrlazyloading-xs-src="img/768x200.gif"
data-bttrlazyloading-xs-width="768"
data-bttrlazyloading-xs-height="200"
data-bttrlazyloading-sm-src="img/345x250.gif"
data-bttrlazyloading-sm-width="345"
data-bttrlazyloading-sm-height="250"
data-bttrlazyloading-md-src="img/455x350.gif"
data-bttrlazyloading-md-width="455"
data-bttrlazyloading-md-height="350"
data-bttrlazyloading-lg-src="img/360x300.gif"
data-bttrlazyloading-lg-width="360"
data-bttrlazyloading-lg-height="300"
/></pre></code>
<h3>Set options on Instantiation</h3>
<pre><code class="javascript">$("#yourImageId").bttrlazyloading({
xs: {
src: "img/720x200.gif",
width: 720,
height: 200
},
sm: {
src: "img/360x200.gif",
width: 360,
height: 200
},
md: {
src: "img/470x200.gif",
width: 470,
height: 200
},
lg: {
src: "img/570x200.gif",
width: 570,
height: 200
},
retina: true,
transition: 'fadeInUp',
delay: 1000,
event: 'click',
container: 'document.body',
threshold: 666,
placeholder: 'test'
})</pre></code>
</section>
<section id="demos">
<div class="page-header">
<h2>Demos</h2>
</div>
<div class="alert alert-info">
<p><b>Plugin dependencies:</b> BttrLazyLoading depends on jQuery (meaning jQuery must be included <strong>before</strong> the plugin files).</p>
</div>
<pre><code class="html"><script src="jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="bttrlazyloading.min.css" />
<script src="jquery.bttrlazyloading.min.js"></script></pre></code>
<p>The following demos are using the same element attributes:</p>
<pre><code class="html"><img id="yourImageId" class="bttrlazyloading"
data-bttrlazyloading-xs='{"src": "img/720x200.gif", "width" : 720, "height" : 200}'
data-bttrlazyloading-sm='{"src": "img/360x200.gif", "width" : 360, "height" : 200}'
data-bttrlazyloading-md='{"src": "img/470x200.gif", "width" : 470, "height" : 200}'
data-bttrlazyloading-lg='{"src": "img/570x200.gif", "width" : 570, "height" : 200}'
/></pre></code>
<p>Surprise that there is no <code>src</code> attribute? Answer <a href="#tip-nosrc" class="smooth-scroll">here</a></p>
<div class="alert alert-warning">A 2 seconds delay has been added to all images for the demos.</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right"><b>Type: Integer, Default: 0</b></div>
<h3 id="demo-delay">
<button class="btn btn-info demo-play" type="button" data-trigger="img-option-delay">
<i class="fa fa-play"></i>
</button> delay
</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6 col-sm-6 col-lg-6">
<img id="img-option-delay" class="bttrlazyloading"/>
<script type="text/javascript">
$(function() {
$('#img-option-delay').bttrlazyloading({
delay: 4000
});
});
</script>
</div>
<div class="col-md-6 col-sm-6 col-lg-6">
<p>Set the delay to 4 seconds:</p>
<pre><code class="javascript">$('#yourImageId').bttrlazyloading({
delay: 4000
});</pre></code>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right"><b>Type: Integer, Default: 0</b></div>
<h3 id="demo-threshold">threshold</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6 col-sm-6 col-lg-6">
<img id="img-option-threshold" class="bttrlazyloading"/>
<script type="text/javascript">
$(function() {
$('#img-option-threshold').bttrlazyloading({
threshold: -200,
triggermanually: false
});
});
</script>
</div>
<div class="col-md-6 col-sm-6 col-lg-6">
<p>The image will be automatically triggered after you scrolled 200px down from the top of the image.</p>
<pre><code class="javascript">$('#yourImageId').bttrlazyloading({
threshold: -200
});</pre></code>
<p>If you want the image loaded before you even see it Set the threshold to a positive integer.</p>
<pre><code class="javascript">$('#yourImageId').bttrlazyloading({
threshold: 200
});</pre></code>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right"><b>Type: String, Default: "bounceIn"</b></div>
<h3 id="demo-animation">
<button class="btn btn-info demo-play" type="button" data-trigger="img-option-animation">
<i class="fa fa-play"></i>
</button> animation
</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6 col-sm-6 col-lg-6">
<img id="img-option-animation" class="bttrlazyloading"/>
<script type="text/javascript">
$(function() {
$('#img-option-animation').bttrlazyloading({
animation: 'slideInLeft'
});
});
</script>
</div>
<div class="col-md-6 col-sm-6 col-lg-6">
<p>Here we will use the 'slideInLeft' animation to show how to overwrite the default "bounceIn" animation.</p>
<pre><code class="javascript">$('#yourImageId').bttrlazyloading({
animation: 'slideInLeft'
});</pre></code>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right"><b>Type: String, Default: "scroll"</b></div>
<h3 id="demo-event">event</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6 col-sm-6 col-lg-6">
<img id="img-option-event" class="bttrlazyloading"/>
<script type="text/javascript">
$(function() {
$('#img-option-event').bttrlazyloading({
event: 'keydown',
triggermanually: false
});
});
</script>
</div>
<div class="col-md-6 col-sm-6 col-lg-6">
<p>By default the updating event <code>window.onscroll</code>. Using the "event" option you can listen to any window event such as "keydown" or "mousedown".</p><p>Press a key on your keyboard to load the image beside (if the image is already loaded, it means you have already pressed a key on your keyboard).</p>
<pre><code class="javascript">$('#yourImageId').bttrlazyloading({
event: 'keydown'
});</pre></code>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right"><b>Type: String, Default:</b> <img src='data:image/gif;base64,R0lGODlhEAALAPQAAP/391tbW+bf3+Da2vHq6l5dXVtbW3h2dq6qqpiVldLMzHBvb4qHh7Ovr5uYmNTOznNxcV1cXI2Kiu7n5+Xf3/fw8H58fOjh4fbv78/JycG8vNzW1vPs7AAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCwAAACwAAAAAEAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJCwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJCwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHTuBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V55zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAAABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7AAAAAAAAAAAA'/></div>
<h3 id="demo-placeholder">
<button class="btn btn-info demo-play" type="button" data-trigger="img-option-placeholder">
<i class="fa fa-play"></i>
</button> placeholder</h3></div>
<div class="panel-body">
<div class="row">
<div class="col-md-6 col-sm-6 col-lg-6">
<img id="img-option-placeholder" class="bttrlazyloading"/>
<script type="text/javascript">
$(function() {
$('#img-option-placeholder').bttrlazyloading({
delay: 4000,
placeholder: 'data:image/gif;base64,R0lGODlhMgAyAKUAAO7u7tri68fX6Nri63Sl21OQ1m2h2pe64b3R5uTo7dvj68PU6KnF42+h2o2039Dc6ejq7aXC46HA42Wc2Xen3MfW6H6q3nmo3KrF5JK233Ok23in3GKa2VqW173Q5szZ6eTo7Je54WOa2bPK5WOb2bnO5oOt3aC/4oSu3mSc2Xam3I2z31uV12qf2dTe6XWl22Sb2Yqx3oWu3Za54VuW2Ju84o2z4MDS573R58vZ6NHd6gAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBwA7ACwAAAAAMgAyAAAG/kCAcEgsGgEBgVJ5bDqfzQGhQK0WDAdEAsqFKhaMhnVcdTy6aCFEE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PK5VqV13in3FqW12Oa2Y2z373Q5qHA46LB4nam3LnO5pu84leT122g2mOb2ZG24Gqe2aC/4qnE49ri6+jq7anF48PU6KXC44Ot3czZ6eTo7KrF5Je54bfN5n+r3Za54X6q3oiw39Te6b3R58vZ6NHd6tvj6wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAb+QIBwSCwahQGBIHBsOp/HAaFgqFqrBcIAyn0eENew2IA4dM+AQ2LMDisWaCej0a6HHYx48WE3QCIREHYSD3pIbBMUFU0VFBNsFoYXYhhwXQsYYwRMZxkaG1YclnELHWIEZwMWFh4fHCCGRBRisFAMq6t5sUUhYoVOIrgWurt7YRLERSMkuCXFTb1XDk0CuBnPTrNXo0MjJqsmI9hNAaZWCkbVqwLjThVhv0PfFuHtTplWJ0TBqyj2TgvCECmBK8U/J4+sLBLCzIKKg9murBAyohlERlcwCOE37GITgQA4ivB4BCQKXCNJFhFkhYk6C+JUEsFXBc5LmUVOXBl5clXQSpwAWIAy0GIjSqAbXbyAkZJjDKQAbvkUksIiUoKrDApRsYoE1IYPh2C1oFVm1VXOhnD0h7OnhZ9C5tVT6Q1cOlzsVL7MS6QuvZgX/c4t8vKaxwx4m4zgivbi2LBNOHb8J3Xqk8qTx2FO5kSGsLTPxlqQgQaxNcB6RpheZRiNZ1wmBKDmMkLAvFWkDWGmN6OskxQzbucqJoKxMBIlaNSoMWLEcholGgpTATdWbeHCsmunx3fc9e3guc+2J6KE8e0qSlQnOUKECAZKGLgfD9VeEAA7'
});
});
</script>
</div>
<div class="col-md-6 col-sm-6 col-lg-6">
<p>Using the placeholder option you can add a custom loading image to replace the default image: <img src='data:image/gif;base64,R0lGODlhEAALAPQAAP/391tbW+bf3+Da2vHq6l5dXVtbW3h2dq6qqpiVldLMzHBvb4qHh7Ovr5uYmNTOznNxcV1cXI2Kiu7n5+Xf3/fw8H58fOjh4fbv78/JycG8vNzW1vPs7AAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCwAAACwAAAAAEAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJCwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJCwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHTuBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V55zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAAABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7AAAAAAAAAAAA'/></p>
<pre><code class="javascript">$('#yourImageId').bttrlazyloading({
placeholder: 'data:image/gif;base64,R0lGODlhMgAyAKUAAO7u...'
});</pre></code>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right"><b>Type: String(Css selector), Default: window</b></div>
<h3 id="demo-container">container</h3></div>
<div class="panel-body">
<div class="row">
<div class="col-md-6 col-sm-6 col-lg-6">
<div id="option-container-wrapper">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In cursus quam nec auctor placerat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nulla ut metus malesuada, congue sem quis, aliquet risus. Pellentesque eget odio sed nibh imperdiet porta. Maecenas quis volutpat diam, at tempor sem. Mauris consequat dui eget nunc semper lobortis. Maecenas libero dui, aliquam ut nibh in, eleifend interdum nibh. Sed ullamcorper eros in sem sollicitudin, et pharetra nisi vulputate. Pellentesque nunc tellus, aliquet quis nisi nec, venenatis tempus nibh. Donec orci nulla, fringilla ac augue eget, lacinia convallis risus.</p>
<p>Sed vel dignissim turpis. Morbi posuere tortor sed purus mattis fermentum. Quisque libero arcu, sollicitudin vitae euismod vel, pharetra sit amet ante. Praesent molestie urna ut tortor pharetra venenatis. Pellentesque posuere, libero ac commodo mattis, sem orci semper erat, eget elementum ligula ante vel metus. Nunc non odio sit amet justo adipiscing iaculis. Duis sodales, dolor sit amet convallis tincidunt, purus velit tristique lorem, at convallis ligula ligula sit amet ligula. Suspendisse mauris ligula, tristique non dui id, laoreet rhoncus tellus.</p>
<img id="img-option-container" class="bttrlazyloading"/>
</div>
<script type="text/javascript">
$(function() {
$('#img-option-container').bttrlazyloading({
container: '#option-container-wrapper',
triggermanually: false
});
});
</script>
</div>
<div class="col-md-6 col-sm-6 col-lg-6">
<p>Instead of using the window, you can specify another scrolling containers, such as a <code>div</code> with scrollbar.</p>
<pre><code class="javascript">$('#yourImageId').bttrlazyloading({
container: '#option-container-wrapper'
});</pre></code>
</div>
</div>
</div>
</div>
<div class="panel panel-default" id="panel-option-retina">
<div class="panel-heading">
<div class="pull-right"><b>Type: Boolean, Default: false</b></div>
<h3 id="demo-retina">
<button class="btn btn-info demo-play" type="button" data-trigger="img-option-retina">
<i class="fa fa-play"></i>
</button> retina
</h3>
</div>
<div class="panel-body">
<div class="col-md-6 col-sm-6 col-lg-6">
<img id="img-option-retina" class="bttrlazyloading"/>
<script type="text/javascript">
$(function() {
$('#img-option-retina').bttrlazyloading({
retina: true
});
});
</script>
</div>
<div class="col-md-6 col-sm-6 col-lg-6">
<div id="alert-option-retina" class='alert alert-info'>You do not have a Retina display therefore you should not see any difference from other demos.</div>
<pre><code class="javascript">$('#yourImageId').bttrlazyloading({
retina: true
});</pre></code>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
// Show if retina display only
if (typeof window.devicePixelRatio === 'number' && window.devicePixelRatio > 1) {
$('#alert-option-retina').hide();
}
});
</script>
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right"><b>Type: Boolean, Default: false</b></div>
<h3 id="demo-triggermanually">
<button class="btn btn-info demo-play" type="button" data-trigger="img-option-triggermanually">
<i class="fa fa-play"></i>
</button> triggermanually
</h3>
</div>
<div class="panel-body">
<div class="col-md-6 col-sm-6 col-lg-6">
<img id="img-option-triggermanually" class="bttrlazyloading"/>
<script type="text/javascript">
$(function() {
$('#img-option-triggermanually').bttrlazyloading({
triggermanually: true
});
});
</script>
</div>
<div class="col-md-6 col-sm-6 col-lg-6">
<pre><code class="javascript">$('#yourImageId').bttrlazyloading({
triggermanually: true
});</pre></code>
<p>Forcing the loading of an image is as easy as that:</p>
<pre><code class="javascript">$('#yourImageId').trigger('bttrlazyloading.load');</pre></code>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right"><b>Type: Boolean, Default: false</b></div>
<h3 id="demo-updatemanually">
<button class="btn btn-success demo-refresh" type="button" data-trigger="img-option-updatemanually">
<i class="fa fa-refresh"></i>
</button> updatemanually</h3>
</div>
<div class="panel-body">
<div class="col-md-6 col-sm-6 col-lg-6">
<img id="img-option-updatemanually" class="bttrlazyloading"/>
<script type="text/javascript">
$(function() {
$('#img-option-updatemanually').bttrlazyloading({
triggermanually: false,
updatemanually: true
});
$('button.demo-refresh').click(function(e) {
var el = $(this).data('trigger');
$('#' + el).trigger('bttrlazyloading.load');
});
});
</script>
</div>
<div class="col-md-6 col-sm-6 col-lg-6">
<pre><code class="javascript">$('#yourImageId').bttrlazyloading({
updatemanually: true
});</pre></code>
<p>Forcing the update of an image is as easy as that:</p>
<pre><code class="javascript">$('#yourImageId').trigger('bttrlazyloading.load');</pre></code>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right"><b>Type: String, Default: #EEE</b></div>
<h3 id="demo-backgroundcolor">
<button class="btn btn-info demo-play img-option-backgroundcolor" type="button">
<i class="fa fa-play"></i>
</button> backgroundcolor</h3>
</div>
<div class="panel-body">
<div class="col-md-6 col-sm-6 col-lg-6">
<img id="img-option-backgroundcolor-blue" class="img-option-backgroundcolor bttrlazyloading"
data-bttrlazyloading-xs-src="demo/img/blue-720x200.jpg"
data-bttrlazyloading-sm-src="demo/img/blue-360x200.jpg"
data-bttrlazyloading-md-src="demo/img/blue-470x200.jpg"
data-bttrlazyloading-lg-src="demo/img/blue-570x200.jpg"/>
<br/>
<img id="img-option-backgroundcolor-orange" class="img-option-backgroundcolor bttrlazyloading"
data-bttrlazyloading-xs-src="demo/img/orange-720x200.jpg"
data-bttrlazyloading-sm-src="demo/img/orange-360x200.jpg"
data-bttrlazyloading-md-src="demo/img/orange-470x200.jpg"
data-bttrlazyloading-lg-src="demo/img/orange-570x200.jpg"/>
<br/>
<img id="img-option-backgroundcolor-green" class="img-option-backgroundcolor bttrlazyloading"
data-bttrlazyloading-xs-src="demo/img/green-720x200.jpg"
data-bttrlazyloading-sm-src="demo/img/green-360x200.jpg"
data-bttrlazyloading-md-src="demo/img/green-470x200.jpg"
data-bttrlazyloading-lg-src="demo/img/green-570x200.jpg"/>
<script type="text/javascript">
$(function() {
$('#img-option-backgroundcolor-blue').bttrlazyloading({
backgroundcolor: '#1A6990',
animation: 'fadeIn'
});
$('#img-option-backgroundcolor-orange').bttrlazyloading({
backgroundcolor: '#D08250',
animation: 'fadeIn'
});
$('#img-option-backgroundcolor-green').bttrlazyloading({
backgroundcolor: '#8FA92D',
animation: 'fadeIn'
});
$('button.demo-play.img-option-backgroundcolor').click(function(e) {
$('.img-option-backgroundcolor').trigger('bttrlazyloading.load');
});
});
</script>
</div>
<div class="col-md-6 col-sm-6 col-lg-6">
<pre><code class="javascript">$('#yourImageId').bttrlazyloading({
backgroundcolor: '#1A6990',
animation: 'fadeIn'
});
$('#yourImageId').bttrlazyloading({
backgroundcolor: '#D08250',
animation: 'fadeIn'
});
$('#yourImageId').bttrlazyloading({
backgroundcolor: '#8FA92D',
animation: 'fadeIn'
});</pre></code>
</div>
</div>
</div>
</section>
<section id="ranges">
<div class="page-header">
<h2>Ranges</h2>
</div>
<p>Ranges define the size of your images for several types of screen. They can only be overwritten for the whole page (using the <a class="smooth-scroll" href="#global-method-setRanges">setRanges</a> global function).</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;" class="hidden-xs">type</th>
<th style="width: 200px;" class="hidden-xs">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>ranges</td>
<td class="hidden-xs">object</td>
<td class="hidden-xs"><pre><code class="json">{<br/> 'xs' : 767,<br/> 'sm' : 768,<br/> 'md' : 992,<br/> 'lg' : 1200<br/> }</pre></code></td>
<td>
<p>Ranges follows Bootstrap 3 grid sizes. <b>xs</b> for phones (<768px), <b>sm</b> for small devices tablets (≥768px), <b>md</b> for medium devices desktops (≥992px) and <b>lg</b> for large devices desktops (≥1200px).</p>
<p>For most of the needs, the default value (Bootstrap 3 grid) does not need to be changed.</p>
</td>
</tr>
</tbody>
</table>
</section>
<section id="methods">
<div class="page-header">
<h2>Destroy</h2>
</div>
<div class="panel panel-default">
<div class="panel-heading"><div class="pull-right"><b>Returns: $(img)</b></div><h3 id="method-destroy">destroy()</h3></div>
<div class="panel-body">
<p>The destroy function removes custom css, custom classes and unbind events but do not remove the image element.</p>
<pre><code class="javascript"># Get the BttrLazyLoading instance and destroy it.
$('#yourImageId').bttrlazyloading('destroy');</pre></code>
<h3>Removing the image element</h3>
<pre><code class="javascript"># Get the BttrLazyLoading instance, destroy it and remove the image element.
$('#yourImageId').bttrlazyloading('destroy').remove();</pre></code>
</div>
</div>
</section>
<section id="global-methods">
<div class="page-header">
<h2>Global methods (jQuery.fn)</h2>
</div>
<div class="alert alert-info">
<p>Two global methods are available to interact with all BttrLazyLoading instances in the page.</p>
</div>
<div class="panel panel-default">
<div class="panel-heading"><div class="pull-right"><b>Returns: bttrlazyloading Global</b></div><h3 id="global-method-setRanges">setRanges()</h3></div>
<div class="panel-body">
<pre><code class="javascript">$.bttrlazyloading.setRanges({
xs: 767,
sm: 768,
md: 992,
lg: 1200
});</pre></code>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><div class="pull-right"><b>Returns: bttrlazyloading Global</b></div><h3 id="global-method-setOptions">setOptions()</h3></div>
<div class="panel-body">
<pre><code class="javascript">$.bttrlazyloading.setOptions({
retina: true,
transition: 'fadeInUp',
delay: 1000,
event: 'click',
container: 'document.body',
threshold: 666,
placeholder: 'test'
});</pre></code>
</div>
</div>
</section>
<section id="events">
<div class="page-header">
<h2>Events</h2>
</div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Event Type</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="break-word">bttrlazyloading.beforeLoad</td>
<td>
<p>This event is triggered just before the "bttrlazyloading.load" event.</p>
</td>
</tr>
<tr>
<td class="break-word">bttrlazyloading.load</td>
<td>
<p>This event is triggered when the image loads. You can trigger it manually like this: <pre><code class="javascript">$('#yourImageId').trigger('bttrlazyloading.load');</pre></code>
</p>
</td>
</tr>
<tr>
<td class="break-word">bttrlazyloading.afterLoad</td>
<td>
<p>This event is triggered just after the "bttrlazyloading.load" event.</p>
</td>
</tr>
<tr>
<td class="break-word">bttrlazyloading.error</td>
<td>
<p>This event is triggered when none of the images (xs, sm, md and lg) exist. The classic "error" event could therefore be triggered up to 8 times (4 times for a normal screen and 8 times for a Retina screen) while "bttrlazyloading.error" will be triggered only once.</p>
<p>More information in the option section: <a href="#demo-onError" class="smooth-scroll">onError</a></p>
</td>
</tr>
</tbody>
</table>
</section>
<section id="tips">
<div class="page-header">
<h2>Tips</h2>
</div>
<h3 id="tip-nosrc">Only one image size needed!</h3>
<p>BttrLazyLoading always try to load the biggest version of the image available. Therefore the following example will work on every screen too.</p>
<pre><code class="html"><img id="yourImageId" class="bttrlazyloading"
data-bttrlazyloading-md-src="img/455x350.gif"
/></pre></code>
<h3 id="tip-nosrc">No src attribute?</h3>
<blockquote>
<p>Browsers are too quick for us! In order to provide the fastest loading time possible, browsers preload all of the images that they can identify</p>
<small><cite>Choosing A Responsive Image Solution, Smashing Magazine</cite></small>
</blockquote>
<p>You may have noticed that none of our image elements have a "src" attribute. Well, that is normal! As describe here by the Smashing Magazine, the browsers preload the images even before the <code>document ready</code> event, which make it impossible for this plugin to process the information before the image loads.</p>
<h3>Fallback for Non JavaScript Browsers</h3>
<pre><code class="html"><img class="bttrlazyloading"
data-bttrlazyloading-xs-src="img/768x200.gif"
data-bttrlazyloading-xs-width="768"
data-bttrlazyloading-xs-height="200"
/>
<noscript>
<img class="bttrlazyloading" src="img/768x200.gif" width="768" height="200"/>
</noscript></pre></code>
<h3>Convenient way to set data attributes</h3>
<p>The following examples are equivalent:</p>
<pre><code class="html"><img id="yourImageId" class="bttrlazyloading"
data-bttrlazyloading-xs-src="img/768x200.gif"
data-bttrlazyloading-xs-width="768"
data-bttrlazyloading-xs-height="200"
/></pre></code>
<pre><code class="html"><img id="yourImageId" class="bttrlazyloading"
data-bttrlazyloading-xs='{"src": "img/768x200.gif", "width" : 768, "height" : 200}'
/></pre></code>
</section>
<section id="feedback">
<div class="page-header">