您好我需要在时间轴中添加项目,我正在使用Shindiri Studio插件(http://www.shindiristudio.com/demo/?item=Content%20Timeline_Wordpress)。根据文件如果我正在添加如下项目
<div class="timelineFlat tl1" id="timeLineContainerDiv">
<div class="time_bg" style="background:#3b3f4f;">
<div class="item" data-id="05/01/2015" data-description="JANUARY, 5" >
<a class="image_rollover_bottom con_borderImage" data-description="ZOOM IN" href="images/flat/default/1.jpg" rel="lightbox[timeline]">
<span class="info_box">Info Box</span>
</a>
<h2>JANUARY, 5</h2>
<span>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exerc...</span>
</div>
</div>
</div>
它的工作正常并得到如下响应
但我想通过java脚本动态添加项目(我在触发一些API调用后得到数据),所以我写的如下所示
function prepareHtml() {
$('#timeLineContainerDiv').html('<div class="time_bg" style="background:#3b3f4f;"><div class="item" data-id="05/01/2015" data-description="JANUARY, 5" ><a class="image_rollover_bottom con_borderImage" data-description="ZOOM IN" href="images/flat/default/1.jpg" rel="lightbox[timeline]"><span class="info_box">Info Box</span></a><h2>JANUARY, 5</h2><span>sample text</span></div></div>');
}
但它不起作用,下面是结果(我认为插件在我附加html之前生成时间轴)。
还有其他方法可以实现这一目标。