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

Weird startAt behavior? #10

Closed
PhyxionNL opened this issue Jul 21, 2014 · 6 comments
Closed

Weird startAt behavior? #10

PhyxionNL opened this issue Jul 21, 2014 · 6 comments

Comments

@PhyxionNL
Copy link

I'm not entirely sure what startAt is doing
"Stick the menu at XXXpx from the top of the this() (nav container)"

I expected that this would start the sticky element at XXXpx from the top, but setting this means that the element you want to stick is scrolled over for the first XXXpx until it actually works. So, I changed a few things to get what I want:

            /* 1.) As soon as we start scrolling */
            if (windowPosition >= $selfScrollTop - options.startAt) {

            /* 3.) As soon as we get back to the top of the page */
            /* If top of the window is over this() (nav container) */
            if (windowPosition + options.startAt <= $selfScrollTop) {

Now, I don't know what the expected behavior is but if the current implementation is correct, can we get something like this added?

@jbutko
Copy link
Owner

jbutko commented Jul 23, 2014

My original intention was exactly as you described here: ""..but setting this means that the element you want to stick is scrolled over for the first XXXpx until it actually works."

If I understand well your desired intention is to have offset from window top - try set navOffset option and let me know if it is what you were looking for.

Will leave it as it is now.

@PhyxionNL
Copy link
Author

navOffset is indeed an offset but not what I am looking for. Let's say this:

  • I want my element 50px from top.
  • With navOffset the element is first at completely at the top of the page (0px) and is then wrapped 50px from the top.

However, it looks much better when the element never gets to the top but starts with the fixed position when its already at 50px from top (so it doesn't just flick to the navOffset). I would appreciate it if you add another setting to this, or better: use the current properties (also use navOffset from the top, if a user wants the current behavior again they can add the XXX pixels to startAt and it'll be the same again).

@jbutko
Copy link
Owner

jbutko commented Jul 23, 2014

I understand what's on your mind. I tried to implement this but with no expected result. I therefore removed navOffset option completely due to unstable behaviour. Maybe in the future I will play with this a bit again. Anyway fell free to submit a pull request if you find any working solution by yourself.

@PhyxionNL
Copy link
Author

The code I posted (pastebin) in the other thread had the expected behavior. Shouldn't be too hard to replace what I used now (options.startAt) with the navOffset I think.

@jbutko
Copy link
Owner

jbutko commented Jul 24, 2014

Try it now but still not working as you wish. It also breaks active class highlighting so this need to be adjusted as well.
If you want to contribute with this feel free to fork the repo and submit pull request. Thanks anyway.

@PhyxionNL
Copy link
Author

I will check it out soon. The version I posted on pastebin is what we have live now, it is working as expected with regards to what I describe above. I'll see if I can integrate this again somehow that it's working.

@jbutko jbutko closed this as completed Aug 14, 2014
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