Select All zepto buttons and change the status based on whether all the buttons are selected. Select All zepto buttons.
During secondary development shopping cart on the mobile phone end, I found that zepto was all selected, not found, or the function was not what I wanted.
Later, I made a good job and shared it with the people who needed it.
// Select all or multiple processes
Var CheckAll = $ ('# items_check_all ');
Var checkbox = $ ('input [name ^ = "check"] ');
Var removeUrl = '<{link app = B2C ctl = wap_cart act = remove}> ';
// Initialize and add all selected States
If (CheckAll & checkbox ){
('.Pt-h-item'hangzhou.addclass('active'hangzhou.css ('background ',' # efefef ');
}
// Select all or none
CheckAll. on ("click", function (){
If (this. checked ){
Checkbox. prop ('checked', true );
// Configure ('.pt-h-item'hangzhou.addclass('active'hangzhou.css ('background ',' # efefef ');
} Else {
Checkbox. prop ('checked', false );
// Configure ('.pt-h-item'mirror.removeclass('active'mirror.css ('background ',' # fff ');
}
});
// Select all button for reverse association after single choice
Checkbox. on ("click", function (){
Var flag = true;
Checkbox. each (function (item ){
Var parent = $ (this). parents ('. pt-h-item ');
If (! This. checked ){
Flag = false;
Parent.removeclass('active'background .css ('background', '# fff ');
} Else {
Parent.addclass('active'hangzhou.css ('background', '# efefef ');
}
})
If (flag ){
CheckAll. prop ('checked', true );
} Else {
CheckAll. prop ('checked', false );
}
});