Created
November 7, 2016 07:33
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy and paste the above code into the Space before box found in