I'm working on a Plugin for the WordPress Customizer and need to call a function when the previewer has loaded. Is there an event or an other method that tells me the preview is loaded?
If have tried:
jQuery(window).load (function() { // Customizer loaded...
wp.customize.previewer.bind( 'refresh', function() { // doesn't seem to work ?!
alert ('Previewer has loaded');
}
}
I've also tried wp.customizer.bind('refresh', function (){
Is there no event that gets fired when the preview is loaded? The refresh event gets fired when the previewer gets refreshed.
Any ideas?
jQuery(window).load
should suffice, no?customize_controls_enqueue_scripts
hook. The JS is outside of the frame in the Customizer.wp.customize.previewFrame.bind( 'load', ...
? It's just a shot in the dark based on a quick poke around core, but worth a try I think.wp.customize.previewFrame.bind( 'load', ...
gives me a TypeError undefined.