I have made a filter that changes category of Portfolio gallery sort for the #anchor on the same page, but the problem is that Mega Menu stays on when item is clicked. What code should I use in the filter to make Mega Menu close when I click on an item?
This is the filter I’ve made:
function hash_select(){
?>
<script type='text/javascript'>
jQuery(window).on('hashchange', function() {
var hash = window.location.hash.substr(1);
jQuery('.'+hash+'_sort_button').click();
});
</script>
<?php
}
add_action('wp_footer', 'hash_select', 110);
UPDATE: Tried adding jQuery(".avia_mega_div").toggle();
to above code, but the mega menu just blinks.
Hi MORTULGAAH,
Can you give us a link to the page mentioned? so we can take a closer look and check further on the behavior of the added js script.
Best regards,
Nikko