/**
* 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 ) {
$( '.ts-site-title a' ).text( to );
} );
} );
wp.customize( 'blogdescription', function( value ) {
value.bind( function( to ) {
$( '.site-description' ).text( to );
} );
} );
// Header text color.
wp.customize( 'header_textcolor', function( value ) {
value.bind( function( to ) {
if ( 'blank' === to ) {
$( '.ts-site-title, .site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)',
'position': 'absolute'
} );
} else {
$( '.ts-site-title, .site-description' ).css( {
'clip': 'auto',
'position': 'relative'
} );
$( '.ts-site-title a, .site-description' ).css( {
'color': to
} );
}
} );
} );
//Font size
wp.customize('bansta_font_size',function ( value ) {
value.bind(function ( to ) {
$( 'body,html' ).css( 'font-size', to + 'px' );
}
);
} );
//Font weight
wp.customize('bansta_font_weight',function ( value ) {
value.bind(function ( to ) {
document.body.style.setProperty('--font-weight', to);
}
);
} );
//Line height
wp.customize('bansta_font_line_height',function ( value ) {
value.bind(function ( to ) {
document.body.style.setProperty('--line-height', to);
}
);
} );
//Logo size
wp.customize('logo_size',function ( value ) {
value.bind(function ( to ) {
document.body.style.setProperty('--logo-size', to + 'px');
}
);
} );
// Site identity font size
wp.customize('site_identity_font_size',function ( value ) {
value.bind(function ( to ) {
document.body.style.setProperty('--site-identity-font-size', to + 'px');
}
);
} );
//Main font Family
wp.customize('bansta_main_font_family',function ( value ) {
value.bind(function ( to ) {
$("head").append("");
document.body.style.setProperty('--primary-font', to);
}
);
} );
//Secondary font family
wp.customize('bansta_secondary_font_family',function ( value ) {
value.bind(function ( to ) {
$("head").append("");
document.body.style.setProperty('--secondary-font', to);
}
);
} );
//Site identity font family
wp.customize('site_identity_font_family',function ( value ) {
value.bind(function ( to ) {
$("head").append("");
document.body.style.setProperty('--site-identity-font', to);
}
);
} );
//Content layout
wp.customize('bansta_content_layout_size',function ( value ) {
value.bind(function ( to ) {
document.body.style.setProperty('--site-content-size', to + 'px');
}
);
} );
//Grid / Slider layout
wp.customize('bansta_grid_layout_size',function ( value ) {
value.bind(function ( to ) {
document.body.style.setProperty('--site-grid-size', to + 'px');
}
);
} );
//Header Layout
wp.customize('bansta_header_layout_size',function ( value ) {
value.bind(function ( to ) {
document.body.style.setProperty('--site-header-size', to + 'px');
}
);
} );
//Background color
wp.customize('bansta_background_color',function ( value ) {
value.bind(function ( newval ) {
document.body.style.setProperty('--background-color', newval );
}
);
} );
//Primary color
wp.customize('bansta_primary_color',function ( value ) {
value.bind(function ( newval ) {
$( '.off-canvas-menu, .header-2, .navigation-menu li.current-menu-item > a, .wp-block-search__button, .copyright, .cancelbtn, form input[type=submit], .ts-category a, .ts-category-2 a' ).css( 'background-color', newval );
}
);
} );
//Secondary color
wp.customize('bansta_secondary_color',function ( value ) {
value.bind(function ( newval ) {
$( '.navigation li a, .entry-post-title a, .read-more a, .widget ul li a' ).css( 'color', newval );
}
);
} );
//Link color
wp.customize('bansta_link_color',function ( value ) {
value.bind(function ( newval ) {
$( '.active, .top-bar-2, #go-to-top' ).css( 'background-color', newval );
$( '.copyright a, span.psw, .psw a, .logged-in-as a, .header-4 .navigation-menu li.current-menu-item > a, .main-nav-3 .navigation-menu li.current-menu-item > a, .navigation-menu li.current-menu-item > a' ).css( 'color', newval );
$( ' .header-4 .navigation-menu li.current-menu-item > a' ).css( 'border-color', newval );
}
);
} );
//Content color
wp.customize('bansta_content_color',function ( value ) {
value.bind(function ( newval ) {
$( 'p' ).css( 'color', newval );
}
);
} );
//Header background image
wp.customize( 'bansta_header_background_image', function (value) {
value.bind( function( newval ) {
$( '.header-wrapper' ).css('background-image', 'url( ' + newval + ')' );
} );
});
//Header background image size
wp.customize('bansta_header_background_image_size', function ( value ) {
value.bind(function ( newval ) {
$( '.header-wrapper' ).css( 'background-size', newval );
}
);
} );
//Header background image position
wp.customize('bansta_header_background_image_position', function ( value ) {
value.bind(function ( newval ) {
$( '.header-wrapper' ).css( 'background-position', newval );
}
);
} );
//Header color
wp.customize('bansta_header_background_color', function ( value ) {
value.bind(function ( to ) {
document.body.style.setProperty('--header-back-color', to );
}
);
} );
//Footer color
wp.customize('bansta_footer_color', function ( value ) {
value.bind(function ( newval ) {
document.body.style.setProperty('--footer-back-color', newval);
}
);
} );
//Copyright color
wp.customize('bansta_copyright_color', function ( value ) {
value.bind(function ( newval ) {
document.body.style.setProperty('--copy-content-color', newval);
}
);
} );
//Topnav color
wp.customize('bansta_topnav_background_color', function ( value ) {
value.bind(function ( newval ) {
document.body.style.setProperty('--top-bar-back-color', newval);
}
);
} );
//Mainnav color
wp.customize('bansta_mainnav_background_color', function ( value ) {
value.bind(function ( newval ) {
document.body.style.setProperty('--mainnav-back-color', newval);
}
);
} );
//Top nav color
wp.customize( 'bansta_top_nav_icon_color', function ( value ) {
value.bind( function ( newval ) {
document.body.style.setProperty('--top-bar-icon-color', newval);
}
);
} );
//Mainnav links color
wp.customize( 'bansta_main_nav_link_color', function ( value ) {
value.bind(function ( newval ) {
document.body.style.setProperty('--menu-link-color', newval);
}
);
} );
//Site identity color
wp.customize( 'site_identity_color', function ( value ) {
value.bind(function ( newval ) {
document.body.style.setProperty('--site-title-color', newval);
}
);
} );
//Menu icon color
wp.customize( 'bansta_menu_icon', function ( value ) {
value.bind(function ( newval ) {
document.body.style.setProperty('--menu-icon-color', newval);
}
);
} );
//Header background image
wp.customize( 'bansta_footer_background_image', function (value) {
value.bind( function( newval ) {
$( '#site-footer' ).css('background-image', 'url( ' + newval + ')' );
} );
});
//Content layout
wp.customize('bansta_image_aspect_ratio',function ( value ) {
value.bind(function ( to ) {
document.body.style.setProperty('--ts-aspect-ratio', to + 'px');
}
);
} );
} )( jQuery );