23 lines
506 B
JavaScript
23 lines
506 B
JavaScript
!function ($) {
|
|
$.fn.cardCheck = function(param) {
|
|
_defaultSettings = {
|
|
check: '',
|
|
};
|
|
_set = $.extend(_defaultSettings, param);
|
|
$card = $(this);
|
|
$check = _set.check;
|
|
$check.each(function(){
|
|
if($(this).attr('checked')) {
|
|
$(this).parent($card).addClass("active");
|
|
}
|
|
});
|
|
$card.on('click', function() {
|
|
$(this).toggleClass('active')
|
|
});
|
|
}
|
|
}(window.jQuery);
|
|
$(function(){
|
|
$('.checkbox-card > li').cardCheck({
|
|
check: $('.checkbox-card > li input[type="checkbox"]'),
|
|
});
|
|
}); |