/* ( function( api ) {

	// Extends our custom "example-1" section.
	api.sectionConstructor['plugin-section'] = api.Section.extend( {

		// No events for this type of section.
		attachEvents: function () {},

		// Always make the section active.
		isContextuallyActive: function () {
			return true;
		}
	} );

} )( wp.customize ); */


function electromixfrontpagesectionsscroll( section_id ){

    var $contents = jQuery('#customize-preview iframe').contents();

    switch ( section_id ) {
        case 'accordion-section-product_one':
        scroll_section_id = "product-one";
        break;

        case 'accordion-section-slider_setting':
        scroll_section_id = "slider";
        break;

        case 'accordion-section-product_two':
        scroll_section_id = "product-two";
        break;
		
        case 'accordion-section-info_setting':
        scroll_section_id = "info";
        break;
		
		case 'accordion-section-category_product_one_setting':
        scroll_section_id = "category-one";
        break;
		
		case 'accordion-section-banner_setting':
		scroll_section_id = "banner-one";
		break;
		
		case 'accordion-section-home_bundled_products_section':
        scroll_section_id = "product-slider";
        break;
		
		case 'accordion-section-banner2_setting':
        scroll_section_id = "banner-two";
        break;
		
		case 'accordion-section-home_slider_products_section':
        scroll_section_id = "product-slider-two";
        break;
		
		case 'accordion-section-product_three':
        scroll_section_id = "product-three";
        break;
		
		case 'accordion-section-banner3_setting':
        scroll_section_id = "banner-three";
        break;
		
		case 'accordion-section-category_product_two_setting':
        scroll_section_id = "category-two";
        break;
		
		case 'accordion-section-filter_products_one_setting':
        scroll_section_id = "filter-product-one";
        break;
		
		case 'accordion-section-product_banner_full_setting':
        scroll_section_id = "banner-full";
        break;
		
		case 'accordion-section-home_slider_products_section2':
        scroll_section_id = "product-slider-three";
        break;
		
		case 'accordion-section-banner4_setting':
        scroll_section_id = "banner-four";
        break;
		
		case 'accordion-section-product_four':
        scroll_section_id = "product-four";
        break;
		
		case 'accordion-section-flash_filter_setting':
        scroll_section_id = "flash-product";
        break;
		
		case 'accordion-section-filter_products_two_setting':
        scroll_section_id = "filter-product-two";
        break;
		
		case 'accordion-section-banner5_setting':
        scroll_section_id = "banner-five";
        break;
		
		case 'accordion-section-sponsor_setting':
        scroll_section_id = "sponsors";
        break;
		
		case 'accordion-section-blog_setting':
        scroll_section_id = "post-section";
        break;
		
		case 'accordion-section-info2_setting':
        scroll_section_id = "info-two";
        break;
		
		case 'accordion-panel-footer_section':
        scroll_section_id = "footer-section";
        break;
    }

    if( $contents.find('#'+scroll_section_id).length > 0 ){
        $contents.find("html, body").animate({
        scrollTop: $contents.find( "#" + scroll_section_id ).offset().top
        }, 1000);
    }
}

 jQuery('body').on('click', '#sub-accordion-panel-electromix_frontpage_sections .control-subsection .accordion-section-title', function(event) {
        let section_id = jQuery(this).parent('.control-subsection').attr('id');
        electromixfrontpagesectionsscroll( section_id );
});

jQuery('body').on('click', '#accordion-panel-footer_section .accordion-section-title', function(event) {
        var footer_id = jQuery(this).parent('.control-panel').attr('id');
        electromixfrontpagesectionsscroll( footer_id );
});

/* Option Disable */
jQuery(function($) {
	jQuery("#sub-accordion-section-footer_background input, #customize-control-site_ttl_size input, #customize-control-site_desc_size input, #sub-accordion-section-footer_background button.wp-color-result, #customize-control-sticky_header_logo button, #customize-control-electromix_site_cntnr_width input, #sub-accordion-section-electromix_sidebar select:not(#_customize-input-electromix_default_pg_sidebar), #customize-control-scroller_icon select, #_customize-input-breadcrumb_title_enable, #_customize-input-breadcrumb_path_enable, #customize-control-breadcrumb_overlay_color button, #sub-accordion-section-electromix_typography select, #sub-accordion-section-electromix_headings_typography select, #sub-accordion-section-electromix_menu_typography select").prop('disabled', true);
	jQuery("#customize-control-product_one_autoplay input, #customize-control-product_one_animation_speed input, #customize-control-product_two_autoplay input, #customize-control-product_two_animation_speed input, #customize-control-slider_autoplay input, #customize-control-slider_animation_speed input, #customize-control-sponsor_cols select, #customize-control-filter_products_one_num input, #customize-control-cat_one_cols select, #customize-control-blog_num input").prop('disabled', true);
});