Open albert-sun opened 1 week ago
Another tiny issue only if you're logged-in as an admin, if you have the WordPress admin header showing (i.e. you're logged-in) then the mega menu wrapper is offset downwards by the height of the header. This can be fixed by subtracting the body offset from the top header:
var html = jQuery("html")[0];
[...]
var bottom = jQuery(this).offset().top + jQuery(this).outerHeight(true) - jQuery(window).scrollTop() - jQuery(html ).offset().top;
Looks good - just make sure there aren't multiple Mega Menu code blocks sitting around or they'll interfere.
Any bug report that doesn't include a Sandbox link or replication steps will be closed. If you can't provide these pieces of information, we're happy to help you via our official support channel instead: https://oxygenbuilder.com/support. You need to select "Something's broken and I need help" from the dropdown box on the left.
Describe the bug Composite element "Mega Menu" breaks offset when using sticky header.
A link to a Sandbox site where the bug has been reproduced https://oxygenbuilder.com/try? (REQUIRED) https://oxygen-qw6lyzw94sd9.oxygen-demo.qsandbox.org/home
IF YOU CAN'T PROVIDE A SANDBOX REPRODUCTION: Steps required to reproduce the bug:
How to fix the bug: The bug is caused by where the mega menu is being placed during its "open" animation. When the sticky header is scrolled down, the value of
jQuery(header).offset().top
within the "Mega Menu Code" block JS (line 21) increases of remaining constant. By subtractingjQuery(window).scrollTop()
from the assignment tobottom
, you can fix this behavior.The new assignment will look as follows:
var bottom = jQuery(this).offset().top + jQuery(this).outerHeight(true) - jQuery(window).scrollTop();
I can't do a side by side comparison because the mega menu code blocks overlap each other, but if you replace Line 21 in the Mega Menu's code block's JavaScript with the above - then the issue will be fixed.