File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 2323 var source = this . getAttribute ( attrib ) ;
2424 source = source || this . getAttribute ( "data-src" ) ;
2525 if ( source ) {
26- this . setAttribute ( "src" , source ) ;
27- if ( typeof callback === "function" ) callback . call ( this ) ;
26+ // if element is an image, set the src
27+ // else, set image as background
28+ + $ ( this ) . is ( 'img' ) ? $ ( this ) . attr ( "src" , source ) : $ ( this ) . css ( 'background-image' , 'url("' + source + '")' ) ;
29+ if ( typeof callback === "function" ) callback . call ( this ) ;
2830 }
2931 } ) ;
3032
3840 et = $el . offset ( ) . top , // distance from document top to top of element
3941 eb = et + $el . height ( ) ; // distance from top of document to bottom of element
4042
41- // the bottom of the element is below the top of the browser (- threshold)
43+ // the bottom of the element is below the top of the browser (- threshold)
4244 // && the top of the element id above the bottom of the browser (+ threshold)
4345 return eb >= wt - th && et <= wb + th ;
4446 } ) ;
You can’t perform that action at this time.
0 commit comments