File tree Expand file tree Collapse file tree 1 file changed +16
-13
lines changed
Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change 3737 var $postContent = $ ( ".post-content" ) ;
3838 $postContent . fitVids ( ) ;
3939
40- var casperFullImg = function ( ) {
41- $ ( "img" ) . each ( function ( ) {
42- var $this = $ ( this ) ,
43- contentWidth = $postContent . outerWidth ( ) , // Width of the content
44- imageWidth = $this [ 0 ] . naturalWidth ; // Original image resolution
45-
46- if ( imageWidth >= contentWidth ) {
47- $this . addClass ( 'full-img' ) ;
48- } else {
49- $this . removeClass ( 'full-img' ) ;
50- }
51- } ) ;
52- } ;
40+ function updateImageWidth ( ) {
41+ var $this = $ ( this ) ,
42+ contentWidth = $postContent . outerWidth ( ) , // Width of the content
43+ imageWidth = this . naturalWidth ; // Original image resolution
44+
45+ if ( imageWidth >= contentWidth ) {
46+ $this . addClass ( 'full-img' ) ;
47+ } else {
48+ $this . removeClass ( 'full-img' ) ;
49+ }
50+ }
51+
52+ var $img = $ ( "img" ) . on ( 'load' , updateImageWidth ) ;
53+ function casperFullImg ( ) {
54+ $img . each ( updateImageWidth ) ;
55+ }
5356
5457 casperFullImg ( ) ;
5558 $ ( window ) . smartresize ( casperFullImg ) ;
You can’t perform that action at this time.
0 commit comments