1

I am trying to run js function when customizer section is expended and cant seem to find any event to do so.

Something like this

wp.customize.bind( 'ready', function() {

    wp.customize.section.bind( 'expand', function() {
            console.log('hello');

    }); 

} );

or

wp.customize.bind( 'ready', function() {

    wp.customize.section.on( 'opened', function() {
            console.log('hello');

    }); 

} );

or anything that triggers when section is active/activated/expanded/opened.

Any help is appreciated!

0

Here it is

wp.customize.bind( 'ready', function() {

    wp.customize.section.each( function ( section ) { 

        section.expanded.bind( function( isExpanding ) {

            if(isExpanding){

                console.log(section);
            }


        });


    });
});
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.