wp/wp-content/themes/twentyfifteen/js/customize-preview.js
changeset 8 c7c34916027a
parent 7 cf61fcea0001
child 9 177826044cd9
equal deleted inserted replaced
7:cf61fcea0001 8:c7c34916027a
     1 /**
       
     2  * Live-update changed settings in real time in the Customizer preview.
       
     3  */
       
     4 
       
     5 ( function( $ ) {
       
     6 	var $style = $( '#twentyfifteen-color-scheme-css' ),
       
     7 		api = wp.customize;
       
     8 
       
     9 	if ( ! $style.length ) {
       
    10 		$style = $( 'head' ).append( '<style type="text/css" id="twentyfifteen-color-scheme-css" />' )
       
    11 		                    .find( '#twentyfifteen-color-scheme-css' );
       
    12 	}
       
    13 
       
    14 	// Site title.
       
    15 	api( 'blogname', function( value ) {
       
    16 		value.bind( function( to ) {
       
    17 			$( '.site-title a' ).text( to );
       
    18 		} );
       
    19 	} );
       
    20 
       
    21 	// Site tagline.
       
    22 	api( 'blogdescription', function( value ) {
       
    23 		value.bind( function( to ) {
       
    24 			$( '.site-description' ).text( to );
       
    25 		} );
       
    26 	} );
       
    27 
       
    28 	// Color Scheme CSS.
       
    29 	api.bind( 'preview-ready', function() {
       
    30 		api.preview.bind( 'update-color-scheme-css', function( css ) {
       
    31 			$style.html( css );
       
    32 		} );
       
    33 	} );
       
    34 
       
    35 } )( jQuery );