Orbit/app/assets/javascripts/lib/checkbox.card.js

23 lines
506 B
JavaScript
Raw Normal View History

2013-07-18 14:36:51 +00:00
!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"]'),
});
});