File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 18
18
// See if which sources match
19
19
for ( var j = 0 , jl = sources . length ; j < jl ; j ++ ) {
20
20
var media = sources [ j ] . getAttribute ( "data-media" ) ;
21
- // if there's no media specified, OR w.matchMedia is supported
22
- if ( ! media || ( w . matchMedia && w . matchMedia ( media ) . matches ) ) {
21
+ // if there's no media specified, OR w.matchMedia is supported OR media has already been loaded
22
+ if ( ! media || ( w . matchMedia && w . matchMedia ( media ) . matches ) || ( sources [ j ] . getAttribute ( "data-loaded" ) !== null ) ) {
23
23
matches . push ( sources [ j ] ) ;
24
24
}
25
25
}
40
40
41
41
picImg . src = matchedEl . getAttribute ( "data-src" ) ;
42
42
matchedEl . appendChild ( picImg ) ;
43
+ matchedEl . setAttribute ( "data-loaded" , "true" ) ;
43
44
picImg . removeAttribute ( "width" ) ;
44
45
picImg . removeAttribute ( "height" ) ;
45
46
}
You can’t perform that action at this time.
0 commit comments