customize-preview.js 832 B

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