Skip to content

Instantly share code, notes, and snippets.

@wpacademy
Created August 16, 2022 22:49
Show Gist options
  • Save wpacademy/c4e48f0b9ce3ae3bd272d5a912081c6c to your computer and use it in GitHub Desktop.
Save wpacademy/c4e48f0b9ce3ae3bd272d5a912081c6c to your computer and use it in GitHub Desktop.
JavaScript code for advanced ecommerce website tutorial by WP Academy.
/*
* Description: JavaScript code for advanced ecommerce website tutorial by WP Academy.
* Author: WP Academy
* Author URL: https://wpacademy.pk
* Usage Info:
Use appropirate jQuery code inside an HTML widget (Elementor) in appropirate sections/templates.
Don't forget to wrap your code inside '<script>YOUR CODE</script>' tags.
*/
// Desktop Header Mega Menu Toggle.
jQuery(document).ready( function() {
jQuery("#toggleMegaMenu").click(
function(){
jQuery(".wpac-mega-menu").slideToggle();
jQuery("#toggleMegaMenu i").toggleClass('fas fa-bars fas fa-chevron-up');
}
);
});
// Mobile Menu Toggle.
jQuery(document).ready( function() {
jQuery("#toggleMobileMenu").click(
function(){
jQuery(".wpac-mobile-menu").slideToggle();
jQuery("#toggleMobileMenu i").toggleClass('fas fa-bars fas fa-chevron-up');
}
);
});
// Shop Page Filters Toggle.
jQuery(document).ready( function() {
jQuery("#toggleMoreFilters").click(
function(){
var filterBtnTxt = jQuery("#toggleMoreFilters .elementor-button-text").text();
jQuery(".wpac-more-filters").slideToggle();
jQuery("#toggleMoreFilters i").toggleClass('fas fa-chevron-down fas fa-chevron-up');
jQuery('#toggleMoreFilters .elementor-button-text').text(
filterBtnTxt == "Show More Filters" ? "Hide More Filters" : "Show More Filters");
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment