Skip to content

Instantly share code, notes, and snippets.

@magician11
Created November 7, 2016 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magician11/dd8d9e2f487d12969de06847f99c903e to your computer and use it in GitHub Desktop.
Save magician11/dd8d9e2f487d12969de06847f99c903e to your computer and use it in GitHub Desktop.
Creates a sticky dropdown for the Fusion Mega Menu for the Avada WordPress theme.
<script>
// makes the dropdown sticky on hover and removes it on scrolling
jQuery(document).ready(function () {
/*
On hovering over the products button, when the mouse is moved away,
then make the dropdown stick by resetting the attributes to do that
per Avada setup.
*/
jQuery('.shop-main-menu').hover(null, function() {
// display the menu again after mouse moves away
jQuery('.fusion-megamenu-wrapper').css({
'visibility': 'visible',
'opacity': 1
});
// not sure why this timeout is needed, but without the attribute does not get changed
setTimeout(function() {
jQuery('.fusion-main-menu').css('overflow', 'visible');
}, 0);
});
// on scrolling anywhere on the page, hide the dropdown
jQuery(window).scroll(function() {
jQuery('.fusion-megamenu-wrapper').css({
'visibility': 'hidden',
'opacity': 0
});
jQuery('.fusion-main-menu').css('overflow', 'hidden');
})
});
</script>
@magician11
Copy link
Author

Copy and paste the above code into the Space before box found in

Avada->Theme Options->Advanced->Code Fields (Tracking etc.)

theme options lumenflex wordpress

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment