1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
$jq(".fppOptions :checkbox").on( "change", function(){
var a = [];
$jq( "#fpp_filter_elements" ).find( "[id^='fppHeader_']" ).each(function( i, item ){
// vous devez alors traiter chaque instance (item) découverte
// $( item ) pour obtenir un objet jQuery
elm = item.id.replace( "fppHeader_", "" );
//alert(elm);
a.push(elm);
});
for (var b = 0; b < a.length; b++) {
//alert(a[b]);
// Filtre les élément qui ont la class fpp_ a
if ($jq(this).hasClass("fppChecked_" + a[b])) {
// Filtre les élément que l'on check
if ($jq(this).attr("checked")) {
// Regarde a quelle option le checkbox appartient (cateroies, attributes, feature, tag, manufacture
//alert($jq(this).val());
ops = $jq(this).attr('class');
ops = ops.replace(/fppChecked_[^\s]+\s?/,'');
ops = ops.replace("fpp_","").trim();
//alert(ops);
FPPRecord.add(ops, $jq(this).val());
// Enregistre les éléments à filtrer
// alert(ops + '--' + $jq(this).val());
// Ajoute la class active
if($jq("span#fppHeader_" + a[b]).hasClass("active")){
}else{
$jq("span#fppHeader_" + a[b]).addClass("active");
}
}else{
FPPRecord.remove(ops, $jq(this).val());
//if (FPPRecord.data[a[b]].length == 0 || $jq("fppSlide_" + a[b]).find(":checked").length == 0) {
if ($jq("#fppSlide_" + a[b]).find(":checked").length == 0) {
$jq("span#fppHeader_" + a[b]).removeClass("active");
}
}
}
}
FPPRecord.sendRequest();
}); |