(function( $ ) {
    'use strict';

    //bind resize functions
    $(document).ajaxComplete(function( event, xhr, settings ) {
        var res = settings['data'].split("&"),
            action = false;
        for (var i = 0; i < res.length; i++) {
            var parts = res[i].split('=');
            if(parts[0] !== undefined && parts[0] == 'action' && parts[1] == 'vc_load_shortcode' )
            {
                action = true;
            } 
        }

        if(action == true)
        {
            setTimeout(function(){
                var iframe = $('#vc_inline-frame-wrapper iframe');
                var ev = iframe[0].contentWindow.document.createEvent('UIEvents');
                ev.initUIEvent('frontend_editor_update', true, true, window, 1);
                iframe.contents().find('body')[0].dispatchEvent(ev);
            },500);

        }

    });

})( jQuery );