我使用的是猫头鹰转盘,当我直接加载项目时,它工作得很好。虽然,当我试图通过 AJAX 加载项目时,那些已经渲染但没有正确显示的项目,甚至导航也不工作。
JQuery初始化轮播
$(".pos-carousel").owlCarousel({
center: true,
items: 1,
loop: true,
margin: 15,
nav: true,
responsive: {
640: {
items: 2,
autoWidth: true,
margin: 30
}
}
});
超文本标记语言....
<div id="creationSelectItem">
<div class="module-content carousel owl-carousel owl-theme pos-carousel creationSelectItem-carousel">
</div>
加载项的JQuery
$(".brand-selection-item img").click(function () {
var selectedBrand = $(this).attr('data-selected-Brand');
$.get("/umbraco/surface/POSCreate/GetTypeStyleOptions", { brandName: selectedBrand }, function (data) {
$(".creationSelectItem-carousel").html(data);
});
});
我在控制台上获得此日志:error log欢迎任何帮助!
3条答案
按热度按时间nwwlzxa71#
加载数据后,您需要初始化carousel:
x7yiwoj42#
在成功函数中添加carousel js。
fnx2tebb3#
试试这个,试了很多次我就能解出来了。