File tree 6 files changed +9
-9
lines changed
6 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ observer.triggerLoad(coolImage);
207
207
Sometimes image loading takes a long time. For this case, you can add a placeholder color:
208
208
209
209
``` html
210
- <img class =" lozad" data-placeholder-color =" red" data-src =" image.png" />
210
+ <img class =" lozad" data-placeholder =" red" data-src =" image.png" />
211
211
```
212
212
213
213
Lozad set the background of ` img ` element and users will see the fallback.
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ <h1><a href="https://github.com/ApoorvSaxena/lozad.js"><strong>Lozad.js</strong>
58
58
< h1 > Lozad.js - Performant Lazy Loading Library</ h1 >
59
59
</ article >
60
60
< article class ="thumb ">
61
- < img class ="lozad " data-placeholder-color ="#583624 " data-src ="images/thumbs/01.jpg " data-index ="1 " />
61
+ < img class ="lozad " data-placeholder ="#583624 " data-src ="images/thumbs/01.jpg " data-index ="1 " />
62
62
< noscript > < img src ="images/thumbs/01.jpg " data-index ="1 " /> </ noscript >
63
63
< h2 > Image 1</ h2 >
64
64
</ article >
Original file line number Diff line number Diff line change @@ -84,8 +84,8 @@ function markAsLoaded(element) {
84
84
}
85
85
86
86
function preLoad ( element ) {
87
- if ( element . getAttribute ( 'data-placeholder-color ' ) ) {
88
- element . style . backgroundColor = element . getAttribute ( 'data-placeholder-color ' ) ;
87
+ if ( element . getAttribute ( 'data-placeholder' ) ) {
88
+ element . style . background = element . getAttribute ( 'data-placeholder' ) ;
89
89
}
90
90
}
91
91
Original file line number Diff line number Diff line change 90
90
}
91
91
92
92
function preLoad ( element ) {
93
- if ( element . getAttribute ( 'data-placeholder-color ' ) ) {
94
- element . style . backgroundColor = element . getAttribute ( 'data-placeholder-color ' ) ;
93
+ if ( element . getAttribute ( 'data-placeholder' ) ) {
94
+ element . style . background = element . getAttribute ( 'data-placeholder' ) ;
95
95
}
96
96
}
97
97
Original file line number Diff line number Diff line change @@ -79,8 +79,8 @@ function markAsLoaded(element) {
79
79
}
80
80
81
81
function preLoad ( element ) {
82
- if ( element . getAttribute ( 'data-placeholder-color ' ) ) {
83
- element . style . backgroundColor = element . getAttribute ( 'data-placeholder-color ' )
82
+ if ( element . getAttribute ( 'data-placeholder' ) ) {
83
+ element . style . background = element . getAttribute ( 'data-placeholder' )
84
84
}
85
85
}
86
86
You can’t perform that action at this time.
0 commit comments