prevent the #zc_header from being added infinitely #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since there are two different .pico-nav elements in the page source (original one simply hidden) the jquery method
$el.insertAfter($target)
will duplicate the$el
and add it to each available $target nodes that isn't the original$el
in the document.This lead to the sticky header upon adding to not be able to be "removed" simply by removing the class
.zc_sticky_header
from it...Before


scrolling down to the bottom and back up produces several copies of the intended sticky header which is to show when the user scrolls the recipe stats out of view though persists at the top of the experience for ever once it appears
After


expected behavior, there is only one element of
#zc_header
regardless of amount the user scrollsbefore and after the sticky stats header appears with the fixed code