问题
I have been trying to trigger the packery animation of resorting the items similar to the page resize. I want the packery items to re-sort when the fullpage slide are switched. I am open to using a different method but I have started down the path of trying to use the fit method, triggered when fullpage.js callbacks "onSlideLeave" and "afterSlideload" happen. My idea was to move one item from the left to the right of the entire grid to force the reshuffle animation. I have created a reduced test case on codepen, reduced test case.
enter code here
I'm sure that I have missed something or I am heading down the wrong direction so any assistance would be great, thanks! It may be important to mention I was using the jquery methods for packery.
回答1:
Apparently I can answer my own question if I discover what I was doing wrong so I hope this isn't poor etiquette. As I commented, I wasn't passing the array number to the fit method. Once I passed that in everything worked as it should. I was able to use existing variables from the fullpage.js library to supply the index number. fixed codepen
var move = $('.move');
$('.grid').packery( 'fit', move[slideIndex], 0, 0 );
来源:https://stackoverflow.com/questions/35212287/i-am-trying-to-force-a-packery-js-shuffle-when-fullpage-js-callbacks-onslideleav