63 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			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();
 | |
| // });
 | |
| !function ($) {
 | |
| 	$.fn.cardCheck = function(param) {
 | |
| 		_defaultSettings = {
 | |
| 			item: '.check-item',
 | |
| 		};
 | |
| 		_set = $.extend(_defaultSettings, param);
 | |
| 		$main = $(this);
 | |
| 		$check = $main.find('input[type="checkbox"]');
 | |
| 		$check.each(function(){
 | |
| 			if($(this).prop('checked')) {
 | |
| 				$(this).parent(_set.item).addClass("active");
 | |
| 			}
 | |
| 		});
 | |
| 		$main.delegate(_set.item, 'click', function(e) {
 | |
| 			$(this).toggleClass('active')
 | |
| 		});
 | |
| 	}
 | |
| }(window.jQuery);
 | |
| optionHeight = function() {
 | |
| 	var $H = $(window).height()-parseInt($('.wrap-inner').css('padding-top'))-$('.bottomnav').innerHeight()-$('#orbit-bar').innerHeight()-2;
 | |
| 	$('.mini-layout-sidebar .nano').height($H);
 | |
| }
 | |
| $(function(){
 | |
| 	if($('.mini-layout-sidebar .nano').length) {
 | |
| 		optionHeight();
 | |
| 		$(window).resize(function() {
 | |
| 			optionHeight();
 | |
| 		});
 | |
| 		$('.mini-layout-sidebar .nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
 | |
| 	}
 | |
| 	if($('.tags').length) {
 | |
| 		$('.tags-groups').cardCheck({
 | |
| 			item: '.card',
 | |
| 		});
 | |
| 	} else {
 | |
| 		$('.checkbox-card').cardCheck();
 | |
| 	};
 | |
| }); |