1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
//When monitor is vertical (portrait mode) var $img = $('.column:first').find('img'); //console.log('img:' + $img.height()); //console.log('w:' + w_h); if($img.height() <= w_h){ $('.column').find('img').css({ 'width': 'auto', 'height': w_h + 'px' }); }else{ $('.column').find('img').css({ 'width': '100%', 'height': 'auto' }); } |