b8e7e8160c7e8b2be03791e57d067fe365148ccf
[autoinstalls/wordpress.git] / wp-content / themes / twentyseventeen / assets / js / customize-controls.js
1 /**
2  * Scripts within the customizer controls window.
3  *
4  * Contextually shows the color hue control and informs the preview
5  * when users open or close the front page sections section.
6  */
7
8 (function() {
9         wp.customize.bind( 'ready', function() {
10
11                 // Only show the color hue control when there's a custom color scheme.
12                 wp.customize( 'colorscheme', function( setting ) {
13                         wp.customize.control( 'colorscheme_hue', function( control ) {
14                                 var visibility = function() {
15                                         if ( 'custom' === setting.get() ) {
16                                                 control.container.slideDown( 180 );
17                                         } else {
18                                                 control.container.slideUp( 180 );
19                                         }
20                                 };
21
22                                 visibility();
23                                 setting.bind( visibility );
24                         });
25                 });
26
27                 // Detect when the front page sections section is expanded (or closed) so we can adjust the preview accordingly.
28                 wp.customize.section( 'theme_options' ).expanded.bind( function( isExpanding ) {
29
30                         // Value of isExpanding will = true if you're entering the section, false if you're leaving it.
31                         wp.customize.previewer.send( 'section-highlight', { expanded: isExpanding });
32                 });
33         });
34 })( jQuery );