Skrollr: Create instant move?

2019-08-07 09:46发布

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条回答
再贱就再见
2楼-- · 2019-08-07 09:53

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

查看更多
登录 后发表回答