1(function($){ 2 3 /** 4 * initializeBlock 5 * 6 * Adds custom JavaScript to the block HTML. 7 * 8 * @date 15/4/19 9 * @since 1.0.0 10 * 11 * @param object $block The block jQuery element. 12 * @param object attributes The block attributes (only available when editing). 13 * @return void 14 */ 15 var initializeBlock = function( $block ) { 16 //$block.find('img').doSomething(); 17 console.log('initialized', $block); 18 console.log($('.main-hero-slider').length); 19 20 if( $('.main-hero-slider').length ){ 21 var home_slider = new Flickity( document.querySelector('.main-hero-slider') , { 22 prevNextButtons: false, 23 pageDots: false, 24 imagesLoaded: true 25 // cellAlign: 'left', 26 // contain: true 27 }); 28 } 29 30 } 31 32 // Initialize each block on page load (front end). 33 $(document).ready(function(){ 34 // $('.testimonial').each(function(){ 35 // initializeBlock( $(this) ); 36 // }); 37 38 //initializeBlock( $(this) ); 39 }); 40 41 // Initialize dynamic block preview (editor). 42 if( window.acf ) { 43 window.acf.addAction( 'render_block_preview/type=home-hero-slider', initializeBlock ); 44 } 45 46})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.