Skrollr: Create instant move?

梦想与她 提交于 2019-12-24 11:10:17

问题


I'm using Skrollr to animate div class="box" using its margin-top, but my issue is that I need an instant change, not animation ..

This JSbin Shows what I'm working on, I need the margin-top of the red div be 0px when data-top-bottom for data-anchor-target=".space" but instantly without animation ...

I'v tried all these properties

skrollr.init({
    forceHeight: true,
    smoothScrollingEnabled: false,
    smoothScrollingDuration: 1,
    smoothScrolling: false,
    forceRender: true
});

but nothing helped me...

So in another way : Is there any way, to go from skrollable-before to skrollable-after without passing through skrollable-between

Hope there is a way to do that ...


回答1:


Simply put an exclamation mark before the values, as documented here https://github.com/Prinzhorn/skrollr#preventing-interpolation

margin-top: !300px;
margin-top: !0px;

http://jsbin.com/degobovi/5/edit



来源:https://stackoverflow.com/questions/24589010/skrollr-create-instant-move

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