Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only last grid is updated on resize #4

Open
MonsieurLanza opened this issue Nov 22, 2016 · 0 comments
Open

Only last grid is updated on resize #4

MonsieurLanza opened this issue Nov 22, 2016 · 0 comments

Comments

@MonsieurLanza
Copy link

MonsieurLanza commented Nov 22, 2016

Hello there,

When using multiple grids with same selector, only the last one will be updated on resize. If you have n grids, the last one will be updated n times.

As far as I understand problem is here :

        for (var i=0;i<grids.length;i++) {
            var grid = grids[i], 
            [...]
            makeGrid(grid, items, o); // <- this call is ok
            var tempf = function() {  makeGrid(grid, items, o); }; // <- this call will not be ok as it is deferred. 
            [...]
        }

"grid" in this function is not a copy of for loop's "grid", it IS the for loop's "grid". So when the event will be fired later on, grid will always have the current "grid" value of the for loop, which already has ended looping long ago => I will always be the last grid.

I may give this a try, but I do not see an easy fix this evening.

MonsieurLanza added a commit to MonsieurLanza/JavaScript-flexImages that referenced this issue Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant