I am trying to force a packery.js shuffle when fullpage.js callbacks onSlideLeave and afterSlideLoad

99封情书 提交于 2019-12-13 01:43:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!