Git Product home page Git Product logo

Comments (6)

jbutko avatar jbutko commented on August 23, 2024

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.

from stickynavbar.js.

PhyxionNL avatar PhyxionNL commented on August 23, 2024

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).

from stickynavbar.js.

jbutko avatar jbutko commented on August 23, 2024

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.

from stickynavbar.js.

PhyxionNL avatar PhyxionNL commented on August 23, 2024

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.

from stickynavbar.js.

jbutko avatar jbutko commented on August 23, 2024

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.

from stickynavbar.js.

PhyxionNL avatar PhyxionNL commented on August 23, 2024

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.

from stickynavbar.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.