I had a problem detecting the visibility of a navigation link inside a custom twitter navigation bar when it is in a folded state.
The root of the problem is that the .collapsed div has an overflow: a hidden rule set for it. This means that although the ul navigation has non-zero dimensions, it is still hidden because the .collapse container has zero height (set in the style attribute in the closed state).
The problem is that if # some-nav-link is one of the li elements in .nav ul, it will match $ ('# some-nav-link: visible') because it does not know that the element is hidden overflow.
Is there any evidence that you can check the visibility of an element that could explain this?
I tried relying on elementFromPoint using the li $ .fn.offset () method, but it is not good enough in cases where li will have some addition, for example, in this case the FromPoint element returns one of li's parents.
NOTE. - My code is third-party code on the corresponding website, so I canβt change anything about how the navigation bar works.
IMPORTANT UPDATE I'm looking for a solution that is independent of the mechanics of how twitter bootstrap crashes. This is a general solution to the problem of determining the visibility of an element located in the overflowing part of a child overflow element: hidden. I felt that it would be better to connect this with the specific problem that caused this question, but if the current issue is considered confusing, I am ready to reconsider it. I hope this update is enough, though.
Thanks for reading, I look forward to some smart decision!
Here is a fiddle showing validation: visible returns true when minimized - http://jsfiddle.net/VDR3Y/
source share