| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/ict/wp-content/plugins/so-widgets-bundle/widgets/image-grid/js/ |
Upload File : |
/* globals jQuery, sowb */
var sowb = window.sowb || {};
jQuery( function ( $ ) {
sowb.setupImageGrids = function () {
$( '.sow-image-grid-wrapper' ).each( function () {
var $$ = $( this );
$$.imagesLoaded( function () {
var maxWidth = $$.data( 'max-width' ),
maxHeight = $$.data( 'max-height' );
if ( maxWidth !== undefined || maxHeight !== undefined ) {
$$.find( 'img' ).each( function () {
var $img = $( this ).css( 'opacity', 1 );
var ratio = $img.width() / $img.height();
var width = [];
// Lets set the widths of the image
if ( maxWidth !== undefined && $img.width() > maxWidth ) {
width.push( maxWidth );
}
if ( maxHeight !== undefined && $img.height() > maxHeight ) {
width.push( Math.round( maxHeight * ratio ) );
}
if ( width.length ) {
width = Math.min.apply( Math, width );
$img.css( 'max-width', width + 'px' );
}
} );
}
else {
$$.find( 'img' ).css( 'opacity', 1 );
}
var alignImages = function () {
};
alignImages();
$( window ).on( 'resize', alignImages );
var event = document.createEvent('Event');
event.initEvent('layoutComplete', true, true);
$$.get(0).dispatchEvent(event);
} );
} );
};
sowb.setupImageGrids();
$( sowb ).on( 'setup_widgets', sowb.setupImageGrids );
} );
window.sowb = sowb;