mardi 4 juin 2019

Only One Checkbox to be Checked in combination with isotope not working in Safari

Isotope filtering on my website is not working correctly in Safari. Here is the problem: I have two checkboxes, when clicking the first one it filters the items just well. When I click the second checkbox the first is unchecked but the filtering does not work correctly. Thats only in Safari, in Firefox and Chrome it's working fine. Here's the code:

    <script type="text/javascript">
    //<!--


    $(window).load(function(){
var $container = $('#isocontainer');
// initialize
$container.isotope({
    itemSelector: '.item'
});
    });

    $(window).resize( function() {
var $container = $('#isocontainer');
// initialize
$container.isotope({
    itemSelector: '.item'
});
    });


    $(function(){

    var $container = $('#isocontainer'),
    $checkboxes = $('#filters input');

    $container.isotope({
    itemSelector: '.item',
    animationEngine: 'jquery'
    });

    $checkboxes.change(function(){
    var filters = [];
    // get checked checkboxes values
    $checkboxes.filter(':checked').each(function(){
    filters.push( this.value );
    });

    filters = filters.join(', ');
    $container.isotope({ filter: filters });
    });

    var $items = $container.children();

    $('input:checkbox').click(function() {
    $('input:checkbox').not(this).prop('checked', false);
    });

    });//-->

    </script>

Anyone have any ideas? And just to let you know: I have only very, very poor knowledge in javascript ...




Aucun commentaire:

Enregistrer un commentaire