Created
February 22, 2016 18:55
-
-
Save fastlinemedia/537df948610ea0c5e5a2 to your computer and use it in GitHub Desktop.
Override the FLBuilderGalleryGrid resize method to set a custom number of columns or adjust the 480px breakpoint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( function( $ ) { | |
$( function() { | |
FLBuilderGalleryGrid.prototype.resize = function() | |
{ | |
var winWidth = $(window).width(), | |
wrap = $(this.wrapSelector), | |
wrapWidth = wrap.width(), | |
numCols = winWidth > 480 ? 3 : 1, | |
items = wrap.find(this.itemSelector), | |
itemWidth = wrapWidth/numCols, | |
itemHeight = itemWidth * this.itemHeight; | |
// Browser bug fix. One column images are streched otherwise. | |
if ( 1 === numCols ) { | |
itemWidth -= 0.5; | |
} | |
// Set the item width and height. | |
items.css({ | |
'float' : 'left', | |
'height' : itemHeight + 'px', | |
'width' : itemWidth + 'px' | |
}); | |
}; | |
} ); | |
} )( jQuery ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note to ditch the
;
on line 13 :)