Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion flex-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ var flexImages = (function(){
for (var k in options) { if (options.hasOwnProperty(k)) o[k] = options[k]; }
var grids = typeof o.selector == 'object' ? [o.selector] : document.querySelectorAll(o.selector);

function _makeTempf(currentGrid, currentItems) {
var grid = currentGrid;
var items = currentItems;
this.eventHandler = function() { makeGrid(grid, items, o); }
}

for (var i=0;i<grids.length;i++) {
var grid = grids[i], containers = grid.querySelectorAll(o.container), items = [], t = new Date().getTime();
if (!containers.length) continue;
Expand All @@ -68,7 +74,7 @@ var flexImages = (function(){
items.push([c, w, norm_w, obj, obj.getAttribute('data-src')]);
}
makeGrid(grid, items, o);
var tempf = function() { makeGrid(grid, items, o); };
var tempf = new _makeTempf(grid, items).eventHandler;
if (document.addEventListener) {
window['flexImages_listener'+t] = tempf;
window.removeEventListener('resize', window['flexImages_listener'+grid.getAttribute('data-flex-t')]);
Expand Down