I am using ajax filter. when I clicked on checkbox other jquery functions are not working. even the filter panel’s trigger also not working.
here is the ajax script
<script type="text/javascript"><!--
$(document).on('change',function(){
filter = [];
$('input[name^=\'filter\']:checked').each(function(element) {
filter.push(this.value);
});
href = '{{action}}&filter=' + filter.join(',');
div = ' #content';
load_href = href + div;
$(div).load(load_href, function() {
$(this).children(':first').unwrap();
// Product List
$('#list-view').click(function() {
$('#content .product-grid > .clearfix').remove();
$('#content .product-grid').attr('class', 'product-layout product-list col-lg-3 col-md-3 col-sm-4 col-xs-6');
$('#grid-view').removeClass('active');
$('#list-view').addClass('active');
localStorage.setItem('display', 'list');
});
// Product Grid
$('#grid-view').click(function() {
// What a shame bootstrap does not take into account dynamically loaded columns
var cols = $('#column-right, #column-left').length;
if (cols == 2) {
$('#content .product-list').attr('class', 'product-layout product-grid col-lg-2 col-md-2 col-sm-3 col-xs-6');
} else if (cols == 1) {
$('#content .product-list').attr('class', 'product-layout product-grid col-lg-2 col-md-2 col-sm-3 col-xs-6');
} else {
$('#content .product-list').attr('class', 'product-layout product-grid col-lg-2 col-md-2 col-sm-3 col-xs-6');
}
$('#list-view').removeClass('active');
$('#grid-view').addClass('active');
localStorage.setItem('display', 'grid');
});
if (localStorage.getItem('display') == 'list') {
$('#list-view').trigger('click');
$('#list-view').addClass('active');
} else {
$('#grid-view').trigger('click');
$('#grid-view').addClass('active');
}
});
setLocation(href);
return false;
});
function setLocation(curLoc){
try {
history.pushState(null, null, curLoc);
return;
} catch(e) {}
location.hash = '#' + curLoc;
}
//--></script>