Stickynav does not check if element is hidden

Created on 17 September 2021, about 3 years ago
Updated 1 November 2023, about 1 year ago

Problem/Motivation

For our use case we only want the sticky for mobile. In the code it checks for $menu.length which will make sure it exists, but not that it's visible.
Also when the nav is hidden, it still tries to calculate the compensation and there is a flicker, despite being no menu to transition into sticky.

Steps to reproduce

- Create a breakpoint (in the CSS sense) and set menu visibility for a certain breakpoint
- Load page at that breakpoint, menu flickers
- Keep page loaded, expand browser, menu now has no correct padding compensation for body.

Proposed resolution

- Change $menu.length to checking for $(element).is(":visible");, and move this evaluation to on browser scroll so that it will continue to check visibility on browser resize.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States asherry

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024