Skip to content Skip to sidebar Skip to footer

Initializing Visual Composer Upon Ajax Content Load

Basic Structure below, have an ajax script that replaces the div inner-content and updates the menu, pushes history states, fade in/out contents ect.. The inner-content contains a

Solution 1:

to add some custom javascript logic after Visual composer grid has been loaded do it like this:

$(window).bind( 'grid:items:added', function(){ 
  // add some logic here
});

for detailes look at this question => here

Solution 2:

Found the data I needed after digging through visual composer's javascript, added a resize action for window which triggers the visual composer's grid to work correctly.

$content.stop(true,true);
window.vc_js();
window.resize();
$('#content').foundation();
$content.html(contentHtml).ajaxify().css('opacity',100).show(); /* you could fade in here if you'd like */// Update the titledocument.title = $data.find('.document-title:first').text();
try {
    document.getElementsByTagName('title')[0].innerHTML = document.title.replace('<','&lt;').replace('>','&gt;').replace(' & ',' &amp; ');
}
catch ( Exception ) { }

Post a Comment for "Initializing Visual Composer Upon Ajax Content Load"