Created
August 13, 2014 16:25
-
-
Save raphaelchaib/a1a6420c8a150b763004 to your computer and use it in GitHub Desktop.
WooCommerce / Javascript: This code transform the WooCommerce Categories List Widget in an accordion.
This file contains hidden or 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
| jQuery(document).ready(function($) { | |
| $(".widget .product-categories > li > .children li").each(function() { | |
| if($(this).has(".children")) { | |
| if(!($(this).hasClass("current-cat-parent"))) { | |
| $(this).find(".children").first().attr("style", "display:none;") | |
| .siblings("a").attr("href", "javascript:void(0);"); | |
| } | |
| } | |
| }); | |
| $(".widget .product-categories > li > .children li a").click(function() { | |
| $(this).siblings(".children").first().toggle(300); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment