/**
* File customizer.js.
*
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/
( function( $ ) {
// Site title and description.
wp.customize( 'blogname', function( value ) {
value.bind( function( to ) {
$( '.site-title a' ).text( to );
} );
} );
wp.customize( 'blogdescription', function( value ) {
value.bind( function( to ) {
$( '.site-description' ).text( to );
} );
} );
// Site logo size
wp.customize( 'mcn_logo_size', function( value ) {
value.bind( function( to ) {
$( '.site-branding img.custom-logo' ).css( 'width', to + '%' );
} );
} );
// Header text color.
wp.customize( 'mcn_headertext_color', function( value ) {
value.bind( function( to ) {
if ( 'blank' === to ) {
$( '.site-title, .site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)',
'position': 'absolute'
} );
} else {
$( '.site-title, .site-description' ).css( {
'clip': 'auto',
'position': 'relative'
} );
$( '.site-title a, .site-description' ).css( {
'color': to
} );
}
} );
} );
// Primary site color
wp.customize( 'mcn_primary_color', function( value ) {
value_global = value;
value.bind( function( to ) {
$( '.site-primary-color' ).css( 'color', to );
$( '.site-primary-bg-color, .select2-container--default .select2-selection--single .select2-selection__arrow' ).css( 'background', to );
$( '.btn-primary, .badge-primary, .nav-links span, .woocommerce nav.woocommerce-pagination ul li span.page-numbers' ).css( 'background', to );
$( 'input[type="submit"], .menu-toggle' ).css( 'background', to );
$( '.btn-primary' ).css( 'border-color', to );
$('head').append('');
$('head').append('');
$('.nav-links a, .woocommerce nav.woocommerce-pagination ul li a.page-numbers').hover(function(){
$(this).css('background', to);
}, function(){
$(this).css('background', 'transparent');
});
$( 'blockquote' ).css( 'border-color', to );
$( '.entry-content a' ).css( 'color', to );
// Woocommerce
$( '.woocommerce a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt,.woocommerce button.button, .woocommerce .woocommerce-cart-form__contents th, .woocommerce #respond input#submit, .woocommerce .widget_price_filter .ui-slider .ui-slider-range' ).css( 'background', to );
$( '.entry-content a.checkout-button' ).css( 'color', '#ffffff' );
} );
});
// Menu bar background color
wp.customize( 'mcn_menu_bar_bg_color', function( value ) {
value.bind( function( to ) {
if( $('.site-hero-image').length ){
$( '.site-header__bar.site-header__fixed' ).css( 'background-color', to );
}else{
$( '.site-header__bar' ).css( 'background-color', to );
}
} );
});
// Menu bar links color
wp.customize( 'mcn_menu_link_color', function( value ) {
value.bind( function( to ) {
$( '.main-navigation a' ).css( 'color', to );
} );
});
// Footer background
wp.customize( 'mcn_footer_background', function( value ) {
value.bind( function( to ) {
$( '.site-footer' ).css( 'background', to );
} );
});
// Footer links color
wp.customize( 'mcn_footer_link_color', function( value ) {
value.bind( function( to ) {
$( '.site-footer a' ).css( 'color', to );
} );
});
// Footer text color
wp.customize( 'mcn_footer_text_color', function( value ) {
value.bind( function( to ) {
$( '.site-footer' ).css( 'color', to );
} );
});
// Footer notes
wp.customize( 'mcn_footer_notes', function( value ) {
value.bind( function( to ) {
$( '#mcn_footer_notes' ).html( to );
} );
});
// Superslider content
wp.customize( 'mcn_title_slider_1', function( value ) {
value.bind( function( to ) {
$( '#mcn_title_slider_1 .mcn-text-inner' ).html( to );
} );
});
wp.customize( 'mcn_desc_slider_1', function( value ) {
value.bind( function( to ) {
$( '#mcn_desc_slider_1 .mcn-text-inner' ).html( to );
} );
});
wp.customize( 'mcn_btn_text_slider_1', function( value ) {
value.bind( function( to ) {
$( '#mcn_btn_text_slider_1 .mcn-text-inner' ).html( to );
} );
});
wp.customize( 'mcn_title_slider_2', function( value ) {
value.bind( function( to ) {
$( '#mcn_title_slider_2 .mcn-text-inner' ).html( to );
} );
});
wp.customize( 'mcn_desc_slider_2', function( value ) {
value.bind( function( to ) {
$( '#mcn_desc_slider_2 .mcn-text-inner' ).html( to );
} );
});
wp.customize( 'mcn_btn_text_slider_2', function( value ) {
value.bind( function( to ) {
$( '#mcn_btn_text_slider_2 .mcn-text-inner' ).html( to );
} );
});
wp.customize( 'mcn_title_slider_3', function( value ) {
value.bind( function( to ) {
$( '#mcn_title_slider_3 .mcn-text-inner' ).html( to );
} );
});
wp.customize( 'mcn_desc_slider_3', function( value ) {
value.bind( function( to ) {
$( '#mcn_desc_slider_3 .mcn-text-inner' ).html( to );
} );
});
wp.customize( 'mcn_btn_text_slider_3', function( value ) {
value.bind( function( to ) {
$( '#mcn_btn_text_slider_3 .mcn-text-inner' ).html( to );
} );
});
} )( jQuery );