angelovcom.net

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

customize.js (839B)


      1 /* global wp, jQuery */
      2 
      3 ( function( $, api ) {
      4 	$( document ).ready( function() {
      5 		// Make it possible to reset the color based on a radio input's value.
      6 		// `active` can be either `custom` or `default`.
      7 		api.control( 'accent_hue_active' ).setting.bind( function( active ) {
      8 			var control = api.control( 'accent_hue' ); // Get the accent hue control.
      9 
     10 			if ( 'custom' === active ) {
     11 				// Activate the hue color picker control and focus it.
     12 				control.activate( {
     13 					completeCallback: function() {
     14 						control.focus();
     15 					}
     16 				} );
     17 			} else {
     18 				// If the `custom` option isn't selected, deactivate the hue color picker and set a default.
     19 				control.deactivate( {
     20 					completeCallback: function() {
     21 						control.setting.set( control.params.defaultValue );
     22 					}
     23 				} );
     24 			}
     25 		} );
     26 	} );
     27 }( jQuery, wp.customize ) );