ru-se.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

multicheck.js (685B)


      1 wp.customize.controlConstructor['kirki-multicheck'] = wp.customize.Control.extend({
      2 
      3 	// When we're finished loading continue processing.
      4 	ready: function() {
      5 
      6 		'use strict';
      7 
      8 		var control = this;
      9 
     10 		// Save the value
     11 		control.container.on( 'change', 'input', function() {
     12 			var value = [],
     13 			    i = 0;
     14 
     15 			// Build the value as an object using the sub-values from individual checkboxes.
     16 			jQuery.each( control.params.choices, function( key, subValue ) {
     17 				if ( control.container.find( 'input[value="' + key + '"]' ).is( ':checked' ) ) {
     18 					value[ i ] = key;
     19 					i++;
     20 				}
     21 			});
     22 
     23 			// Update the value in the customizer.
     24 			control.setting.set( value );
     25 
     26 		});
     27 
     28 	}
     29 
     30 });