Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinned element jumps #601

Open
sarahgracesmith opened this issue Sep 29, 2016 · 2 comments
Open

Pinned element jumps #601

sarahgracesmith opened this issue Sep 29, 2016 · 2 comments

Comments

@sarahgracesmith
Copy link

Similar to #595 but it isn't a constant jump. It mostly behaves as desired but there's a little jump as you scroll down. See the example:
https://jsfiddle.net/nzg9nmab/2/

@pauljohnknight
Copy link

Hi Sarah, Have you tried using ScrollMagic with Greensock? You could set the heading so it's Y co-ordinate is 0 and then pin it by matching the both length of the tween with the duration in Scrollmagic ? For instance:

`
var box = getElementById("box"); // a standard box div

// GREENSOCK

TweenMax.set(box, {y: 0}); // prepares box for fixed scrolling effect wherever it is on the page

var moveBox = TweenMax.to (box, 1, {y:320, ease:Linear.easeNone}); // where the Y coordinate will match the duration in the ScrollMagic scene below to create the effect of it being fixed.

// SCROLLMAGIC

var controller = new ScrollMagic.Controller();

var homeBoxMove = new ScrollMagic.Scene ({
triggerElement: box,
duration: 320, // matches length of Y axis tween.
triggerHook: 0.6
})
.setTween(moveBox)
.addIndicators()
.addTo(controller);
});

`

@sarahgracesmith
Copy link
Author

The issue seemed related to position: absolute. When I switched to position: relative it quit jumping. (I didn't try to apply your suggestion to the position: absolute case)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants