我试图强制一个packery.js shuffle当fullpage.js回调onSlideLeave和afterSlideLoad [英] I am trying to force a packery.js shuffle when fullpage.js callbacks onSlideLeave and afterSlideLoad

查看:212
本文介绍了我试图强制一个packery.js shuffle当fullpage.js回调onSlideLeave和afterSlideLoad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试触发类似于页面大小调整的项目的包装动画。我希望在切换整页幻灯片时重新排序包装项目。我愿意使用不同的方法,但我已经开始尝试使用fit方法,当fullpage.js回调onSlideLeave和afterSlideload发生时触发。我的想法是从整个网格的左侧移动一个项目以强制重新洗牌动画。我在codepen上创建了一个简化的测试用例,减少了测试用例

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我确定我错过了一些东西,或者我正朝着错误的方向前进,所以任何帮助都会很棒,谢谢!值得一提的是我正在使用jquery方法进行打包。

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.

推荐答案

显然,如果我发现自己做错了,我可以回答自己的问题,所以我希望这不是很差的礼仪。正如我评论的那样,我没有将数组编号传递给fit方法。一旦我通过它,一切都按照应有的方式进行。我能够使用fullpage.js库中的现有变量来提供索引号。 固定代码簿

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 );

这篇关于我试图强制一个packery.js shuffle当fullpage.js回调onSlideLeave和afterSlideLoad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆