/* global wp, jQuery */ /** * File customizer.js. * * Theme Customizer enhancements for a better user experience. * * Contains handlers to make Theme Customizer preview reload changes asynchronously. */ ( function( $ ) { const blog_stream_section_lists = ['banner']; blog_stream_section_lists.forEach(blog_stream_homepage_scroll_preview); function blog_stream_homepage_scroll_preview(item, index) { // Collect information from customize-controls.js about which panels are opening. wp.customize.bind('preview-ready', function() { // Initially hide the theme option placeholders on load. $('.panel-placeholder').hide(); item = item.replace(/-/g, '_'); wp.customize.preview.bind(item, function(data) { // Only on the front page. if (!$('body').hasClass('home')) { return; } // When the section is expanded, show and scroll to the content placeholders, exposing the edit links. if (true === data.expanded) { $('html, body').animate({ 'scrollTop': $('#blog_stream_' + item + '_section').position().top }); } }); }); } }( jQuery ) );