-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[Sticky] Transitions when adjusting height #8645
Comments
Hi, i've done some more work on it last week, and changed the way container resizing is fired up. But I didn't PR for it yet. Thanks for the report ! |
@gehasia Thanks for the quick response. I am working on a fix for #8435 that is different from the suggested solutions. This may be the same thing you are trying to achieve. I was going to see what people think about adding an option to Sticky, named something like You would set the option to false if the sticky element will change height when it becomes stuck/unstuck. When it's false, it won't do anything with the height (which is the current behavior), allowing you flexibility to alter the height in CSS or JS between sticky states. I'll put in my PR tomorrow so you can check it out and see if we're talking about the same issue. |
@colin-marshall I made some videos to show different behaviors. The current foundation "stable" behavior, as seen in the current online documentation : The sticky container does not resize so the nav-bar just resize into this "fixed height" element. It flash 'red' on mouse wheel, and if we scroll down with mouse-click on scroll bar we just see the container. When it's white container on white background (like it is in current documentation example) it's not odd, but if you start to have different colors it'll flash and be ugly... That's the behavior i tried to correct with my first patch proposal Current develop branch (with my merged PR....): Now the container resizes, BUT it resizes AFTER transition (because the code wait for the transition to end before firing container resizing, it needs to end to get the correct size by DOM inspection). So here is my new proposal, the first one is a patch to resize BEFORE transition : So i made a little more to the patch to add a "slowdown this scroll down": Behavior with scrollbar is still ok, behavior with mouse wheel is now OK too. The patch consists to force to scroll down only 1px when setting the element to is-stuck. So if the mouse wheel step said to scroll down 50px, the code force it to 1px only (just the scroll step who fired the is-stuck code) and then let the others 'scroll steps' to occurs normally. It can be seen in the video by seing the scroll bar wich seems to be a little bit stuck (glued) on top when starting to scroll down. How does it work : As you said maybe your PR will achieve the same goal, i need to see it. i'll check when you'll link it here. |
Here is my PR if you can have a look. I can add some option to enable/disable this behavior if needed. |
@gehasia thanks for your work in getting the PR up for me to check out. Do you think you could turn that sticky topbar example you were using in your videos to a visual test in the Please pull in the latest commits from develop to get a visual test I made (209e9e2) so you can check that against your PR branch. I think you will notice a few things about containers losing height when they become unstuck. This is fixed in my PR #8663, please check out when you have a moment. I think the issue I was trying to solve was a bug with containers losing height and you were trying to solve a bug with transition timings and height changes. They are different but closely related. I will experiment tomorrow with a combination of both our PR's to see if I can get both of our solutions working with each other. |
I've merged your code in my repo gehasia@afa536f and made the visual test page + minor bugfix gehasia@68575a6 and everything seems to be ok, both seems to work flawlessly. I honestly don't know in which order you can merge the whole stuff because i'm using your this.staticHeight property in a if test for my code now. Let me now if you need a new clean PR after your merged yours. I kept the anchor test in my transition height test, because i may like to fix the bug of the sticky element which stick to "windows top" instead of "stuck navbar bottom", and thus is hidden behind the sticky navbar. |
Another thing, i tried to just add in instead of your patch, and it seems to do the trick your are resolving with your patch but without the need to add an option (staticHeight). Maybe it's not a good solution to add those kind off inline css, but it's a one liner which is working for me. |
@gehasia thanks for looking into it and making the visual test. I think your solution of |
@colin-marshall Here are two independant PR : You'll see the badly positioned element when you reach the bottom of #foo8 for test4 (test4 after merging this PR). The element should anchor there but instead jump in th middle of #foo9 ... The second one is the actual fix for height without any options : It also fix this issue #8587 So you may apply both and test and compare to yours, i didn't see any bug remaining. If it got merged i will redo a PR for the sticky nav bar height transition after that. |
@gehasia did we forget to revert this?: I'm still seeing the "jerky" transitions in the sticky docs for the sticky nav example. |
Not sure if this is still relevant. So far I did not see any of these issues in the last releases. Feel free to reopen if it does still occur. |
@gehasia you recently introduced commit 26e716e. I think the lines about transitions have messed up the behavior in the sticky-nav example at the bottom of the Sticky docs. The transition is now jerky and the offset is messed up too. You can only see the bug in local docs, so compare to the live version of the Sticky docs for normal behavior.
@gehasia please have a look when you get a chance, we are working on polishing up the Sticky plugin this week. Thanks!
The text was updated successfully, but these errors were encountered: