在下面

问题描述:

基本结构Ajax内容加载初始化可视化编辑器,有一个AJAX脚本,它取代了DIV内的内容,并更新菜单,推动历史状态,淡入/淡出内容等..在下面

内含量包含基础网格行,并且wordpress编辑器的内容位于该容器内。

现在使用需要JavaScript触发器,全宽跨度,滑块,动画没有东西再当我的AJAX功能触发内容替换加载任何视觉作曲家功能时,这里的问题...。

这里是我的代码加载后阿贾克斯拿到了内容部分。

// Update the content 
$content.stop(true,true); 
//$("[data-vc-grid-settings]").vcGrid(); 
$('#content').foundation(); 
$content.html(contentHtml).ajaxify().css('opacity',100).show(); /* you could fade in here if you'd like */ 

// Update the title 
document.title = $data.find('.document-title:first').text(); 

我以为.vcGrid()是正确的初始化,但得到了没有定义控制台错误。 我在哪里可以找到重新初始化视觉作曲家元素相关的文档?

<html> 
<header> 
Meta Content 
</header> 
<div off-canvus> 
    <menu></menu> 
    <div content> 
     <div inner-content> 

     </div> 
    </div> 
    <footer> 
    </footer> 
    <scripts> 
</html> 

找到我需要通过视觉作曲家的JavaScript挖后的数据,增加了窗口大小调整动作来触发视觉作曲家的电网才能正常工作。

$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 title 
document.title = $data.find('.document-title:first').text(); 
try { 
    document.getElementsByTagName('title')[0].innerHTML = document.title.replace('<','&lt;').replace('>','&gt;').replace(' & ',' &amp; '); 
} 
catch (Exception) { } 
+0

我知道这是迟到问,但我有同样的问题,你的代码不适合我。 我得到错误window.resize()不是一个函数。 也尝试的jQuery( “[数据-VC网格的设置]”)vcGrid();并给出了vcGrid不是一个函数 – buxbeatz

+0

加载其他资源之前@buxbeatz要装入你的代码。 – vico

添加一些自定义后视觉作曲家电网JavaScript逻辑已加载像这样做:

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

为detailes看待这个问题=>here