Comments (6)
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.
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.
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.
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.
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.
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)
- Unable to get property 'top' of undefined or null referrence HOT 1
- Anchors with relative URL's don't work. HOT 3
- Add active class? HOT 2
- Option to Remove Target Links? HOT 2
- Could I change "nav bar position" style to vertical (not top)? HOT 3
- Two sections are highlighted at the same time.
- Use element.getBoundingClientRect().top rather than element.offsetTop HOT 1
- Last element is not being highlighted properly.
- When navbar isn't fixed, clicking on menu item takes you a little above start of section HOT 3
- Main window Scrollbar does not work when clicking to scroll. HOT 1
- Disappears on scroll
- Version Differential HOT 1
- jQuery conflict with li a[href*=#] HOT 1
- Relative links do not work in Bootstrap 3 or 4 HOT 3
- Error with relative links HOT 1
- publish latest version on NPM HOT 1
- About jquery.stickyNavbar.css HOT 2
- First child first click doesn't add activeClass
- Bootstrap 3 & 4 Dropdown support?
- Sticky nav sometime doesn't work in safari HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stickynavbar.js.