jeudi 2 mars 2017

Need to reload div after checkbox has been checked and then unchecked again

The following code works on a normal website but because I am using the Webflow CMS, I am running into an issue when I check a filter checkbox and then go back and uncheck it. Once unchecked again, it doesn't show all options like it does when the page loads. I'm hoping there's a better/more general way to reset back to the way it is on load that will work with the CMS. I'm pretty sure the issue has to do with the class placement of '.products' but I'm limited by the CMS.

$('input[type="checkbox"]').click(function() {
    if ($('input[type="checkbox"]:checked').length > 0) {
  $('.product').hide();
        $('input[type="checkbox"]:checked').each(function() {
$('div[data-group*=' + this.value + ']').fadeIn();
        });
    } else {
        $('.products > div').fadeIn();
    }
});

Here's full working example: http://ift.tt/2liV0dt

Here's where code is being implemented: http://ift.tt/2m0KQv9

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire