-
Notifications
You must be signed in to change notification settings - Fork 516
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
Deatching doesn't work correctly when window scroll position is not top / "stickyness" is active #34
Comments
@simonvart |
I placed the modified file in a jsfiddle http://jsfiddle.net/z3y6B/ I initiated the file with :
and as I remove the recalculation on window resize from the plugin, I have to do it "manually" after the init :
If you have any issue it would be more convienient to talk outside of github. |
Nice one! Now everything works. Thanks a lot. |
Good to know ! You're welcome. |
This is a great fix, was struggling with this for hours. @simonvart you should definitely submit this as a pull request to improve this plugin. |
Thanks, I will consider to create a fork, merge my modification and ask for a pull request. |
Hello,
I'm working on a responsive website with a horizontal navbar that should be fixed positioned / sticky if the user scrolls down, but only for windows with a certain width (e.g. wider than 601px). If the screen width changes below this threshold (e.g. lower than 600px) the "stickness" should be removed. When changing back to a wider width it should be re-added again and so on ...
Everything works fine as long as the scroll position is top (or the stickynes is not already triggered) when the window width change happens.
Otherwise, for example when you have scrolled down a little and change the window with afterwards (which calls the detach method) the complete navbar gets removed from the DOM.
I've created a fiddle to explain the problem: http://jsfiddle.net/4msAr/4/
Example:
Bugs happen:
Did I understand something wrong? I expected the detach method to remove the spacer container and removing the inline-styles on the sticky-target / navbar.
Here's the actual code (which I also used for the fiddle):
/* EXAMPLE */
$(function() {
});
The text was updated successfully, but these errors were encountered: