我做的方式,它是通过以下使scrollorama块阵列(在scrollorama插件中找到)可供scrollorama对象:
//ignore this, just a line example for where to put it...
scrollorama.destroy = function(){
//...
}
//add the following:
scrollorama.blocks = blocks;
然后,带着几分的调查,我通过循环每个块和动画,并通过新的计算量更改相关动画。查看console.log中的块对象;所有的值都由相同的名字设置,并在插件中被引用来计算滚动事件。
这是什么,我会然后在窗口的resize
事件做一个例子:
var thirdWindowHeight = Math.round(windowObj.height/3),
bannerHeight = $wrapper.find(".banner img:first").height(),
dragDuration = $body.find("#page").height(),
headerHeight = $body.find("#masthead").height(),
delay = bannerHeight - headerHeight,
animations,
animation;
for (var i = 0, j = this.scrollorama.blocks.length; i < j; i++) {
animations = this.scrollorama.blocks[i].animations;
for (var k = 0, l = animations.length; k < l; k++) {
animation = animations[k];
$wrapper.find(animation["element"].selector).removeAttr("style");
switch (animation["element"].selector) {
case ".banner img":
animation.endVal = thirdWindowHeight;
animation.duration = bannerHeight;
break;
case ".drag":
animation.delay = delay;
animation.duration = dragDuration;
animation.endVal = dragDuration;
break;
}
}
}
$(window).triggerHandler("scroll");
你有没有弄清楚如何把Scrollorama您引导网站?我一直试图让我的工作好几天,我甚至无法让动画工作。有什么建议? – Brian 2013-01-26 00:11:25
试试我的解决方案,下面... – marksyzm 2013-08-13 08:48:40