• 1.
     
  • 2.
    //Checkox Accordion part 1. See part 2 a pageload with one of the options checked
  • 3.
    $(document).on('click', '.facetwp-type-checkboxes .facetwp-expand', function (e) {
  • 4.
        $(this).toggleClass('contracted');
  • 5.
     
  • 6.
        //Accordion part 1. See part 2 a pageload with one of the options checked
  • 7.
        $(this).closest('.facetwp-checkbox').siblings('.facetwp-checkbox').each(function() {
  • 8.
            $( this ).next('.facetwp-depth').removeClass('visible');
  • 9.
            $( this ).children('.facetwp-expand').removeClass('contracted');
  • 10.
        });
  • 11.
     
  • 12.
        e.stopPropagation();
  • 13.
    });
  • 14.
     
  • 15.
     
  • 16.
    //Checkox Accordion part 2. For the minus icons on a pageload with selections
  • 17.
    $(document).on('facetwp-loaded', function () {
  • 18.
     
  • 19.
        $('.facetwp-type-checkboxes .facetwp-depth').each(function() {
  • 20.
            if ($( this ).hasClass('visible')) {
  • 21.
                $( this ).prev('.facetwp-checkbox').children('.facetwp-expand').addClass('contracted');
  • 22.
            }
  • 23.
        });
  • 24.
     
  • 25.
    });
  • 26.
     
  • 27.
     
  • 28.
    //CSS
  • 29.
     
  • 30.
    .facetwp-type-checkboxes .facetwp-depth {
  • 31.
        display: none;
  • 32.
    }
  • 33.
     
  • 34.
    .facetwp-type-checkboxes .facetwp-depth.visible {
  • 35.
        display: inherit;
  • 36.
    }
//Checkox Accordion part 1. See part 2 a pageload with one of the options checked $(document).on('click', '.facetwp-type-checkboxes .facetwp-expand', function (e) { $(this).toggleClass('contracted'); //Accordion part 1. See part 2 a pageload with one of the options checked $(this).closest('.facetwp-checkbox').siblings('.facetwp-checkbox').each(function() { $( this ).next('.facetwp-depth').removeClass('visible'); $( this ).children('.facetwp-expand').removeClass('contracted'); }); e.stopPropagation(); }); //Checkox Accordion part 2. For the minus icons on a pageload with selections $(document).on('facetwp-loaded', function () { $('.facetwp-type-checkboxes .facetwp-depth').each(function() { if ($( this ).hasClass('visible')) { $( this ).prev('.facetwp-checkbox').children('.facetwp-expand').addClass('contracted'); } }); }); //CSS .facetwp-type-checkboxes .facetwp-depth { display: none; } .facetwp-type-checkboxes .facetwp-depth.visible { display: inherit; }

Copy Code to Clipboard Raw

Sign-in or Create a Free Account.

Snippi uses Twitter or Facebook to register and create accounts. Registration will enable you to keep track of your snippets. We never spam your timeline or wall. Ever.

Sign-in with Facebook Sign-in with Twitter