js 动态加载html拼接css 失效
在页面上直接写html 标签布局合适的
<div id="videoMain">
<div class="m-video" data-src="../../video/123.mp4">
<a><img src="../../img/uploadImg/123.jpg" alt="无法显示图片" />
<span>遮罩层处处出出错遮罩</span></a>
</div>
<div class="m-video">
<a><img src="../../img/uploadImg/123.jpg" alt="无法显示图片" />
<span>遮罩层处处出出错遮罩</span></a>
</div>
</div>
但是用js 动态拼接加上去之后部分样式失效了!!!
<script>
$(function() {
var html = '';
html += '<div class="m-video" data-src="../../video/123.mp4">';
html += '<a><img src="../../img/uploadImg/123.jpg" alt="无法显示图片" />';
html += '<span >遮罩层处处出出错遮罩</span></a>';
html += '</div>';
$("#videoMain").append(html);
$("#videoMain").trigger('create');
});
</script>