/** * Script fort the customizer sections scroll function. * * @since 1.0 * @package Allo * * @author Themelocation */ /* global wp */ var allo_customizer_section_scroll = function ( $ ) { 'use strict'; $( function () { var customize = wp.customize; customize.preview.bind( 'clicked-customizer-section', function( data ) { var sectionId = ''; switch (data) { case 'shop': sectionId = 'section#products'; break; case 'ribbon': sectionId = 'section.allo-ribbon'; break; case 'sub-accordion-section-sidebar-widgets-subscribe-widgets': sectionId = 'section#subscribe'; break; case 'bar': sectionId = 'section.allo-clients-bar'; break; case 'slider': sectionId = '#carousel-allo-generic.carousel.slide'; break; default: sectionId = 'section#' + data; break; } if ( $( sectionId ).length > 0) { $( 'html, body' ).animate( { scrollTop: $( sectionId ).offset().top - 100 }, 1000 ); } } ); } ); }; allo_customizer_section_scroll( jQuery );