我在与waypoints.js相关的网站上有一些动画(使用Adobe Edge Animate制作)。如果用户滚动到某些航点,则脚本会执行动画的javascript,如下所示:
var $datenbeschaffung_an = $('.datenbeschaffung');
$datenbeschaffung_an.waypoint(function(direction) {
if (direction === 'down') {
AdobeEdge.loadComposition('animation_beschaffung_151116', 'EDGE-514335', {
scaleToFit: "both",
bScaleToParent: "true",
centerStage: "horizontal",
minW: "0px",
maxW: "undefined",
width: "870px",
height: "710px"
}, {"dom":{}}, {"style":{"${symbolSelector}":{"isStage":"true","rect":["undefined","undefined","870px","710px"],"fill":["rgba(255,255,255,1)"]}},"dom":[{"rect":["0","0","870px","710px","auto","auto"],"id":"Poster","fill":["rgba(0,0,0,0)","images/fallback_beschaffung.png","0px","0px"],"type":"image","tag":"img"}]});
}
}, {
offset: '20%'
});
$datenbeschaffung_an.waypoint(function(direction) {
if (direction === 'up') {
AdobeEdge.loadComposition('animation_beschaffung_151116', 'EDGE-514335', {
scaleToFit: "both",
bScaleToParent: "true",
centerStage: "horizontal",
minW: "0px",
maxW: "undefined",
width: "870px",
height: "710px"
}, {"dom":{}}, {"style":{"${symbolSelector}":{"isStage":"true","rect":["undefined","undefined","870px","710px"],"fill":["rgba(255,255,255,1)"]}},"dom":[{"rect":["0","0","870px","710px","auto","auto"],"id":"Poster","fill":["rgba(0,0,0,0)","images/fallback_beschaffung.png","0px","0px"],"type":"image","tag":"img"}]});
}
}, {
offset: '-2%'
});
脚本工作正常,但如果用户滚动得非常快,动画就不会加载,因为视口时间很短,无法呈现完整的动画。你可以在here上查看!测试它:向下滚动非常快,然后再向上滚动:如您所见,动画未完全加载。
你有解决方法吗?