customize-controls.js 800 B

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * File customize-controls.js.
  3. *
  4. * Brings logo resizing technology to the Customizer.
  5. *
  6. * Contains handlers to change Customizer controls.
  7. */
  8. ( function( $ ) {
  9. 'use strict';
  10. var api = wp.customize;
  11. api.bind( 'ready', function() {
  12. $( window ).load( function() {
  13. if ( false == api.control( 'custom_logo' ).setting() ) {
  14. $( '#customize-control-logo_size' ).hide();
  15. }
  16. } );
  17. } );
  18. // Check logo changes
  19. api( 'custom_logo', function( value ) {
  20. value.bind ( function ( to ) {
  21. if ( '' === to ) {
  22. api.control( 'logo_size' ).deactivate();
  23. } else {
  24. $( '#customize-control-logo_size' ).show();
  25. api.control( 'logo_size' ).activate();
  26. api.control( 'logo_size' ).setting( 50 );
  27. api.control( 'logo_size' ).setting.preview();
  28. }
  29. } );
  30. } );
  31. } )( jQuery );