25 lines
572 B
JavaScript
25 lines
572 B
JavaScript
|
function cardCheck() {
|
||
|
if($('.tags').length) {
|
||
|
var $card = $('.checkbox-card .card'),
|
||
|
$check = $card.children($('input[type="checkbox"]'));
|
||
|
$check.each(function(){
|
||
|
if($(this).attr('checked')) {
|
||
|
$(this).parent(".check").addClass("active");
|
||
|
}
|
||
|
})
|
||
|
} else {
|
||
|
var $card = $('.checkbox-card>li'),
|
||
|
$check = $('input[type="checkbox"]');
|
||
|
$check.each(function(){
|
||
|
if($(this).attr('checked')) {
|
||
|
$(this).parent("li").addClass("active");
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
$card.on('click', function() {
|
||
|
$(this).toggleClass('active')
|
||
|
});
|
||
|
}
|
||
|
$(function(){
|
||
|
cardCheck();
|
||
|
});
|