我正在使用猫头鹰旋转木马,当我直接加载物品时,它的工作效果很好。虽然,当我尝试通过AJAX加载项目时,这些项目已呈现但未正确显示,甚至无法导航。
jQuery初始化轮播
$(".pos-carousel").owlCarousel({
center: true,
items: 1,
loop: true,
margin: 15,
nav: true,
responsive: {
640: {
items: 2,
autoWidth: true,
margin: 30
}
}
});
HTML...。
<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);
});
});
我在控制台上收到此日志:错误日志欢迎任何帮助!
您需要在加载数据后初始化轮播:
$.get("/umbraco/surface/POSCreate/GetTypeStyleOptions", { brandName: selectedBrand }, function (data) {
$(".creationSelectItem-carousel").html(data);
$(".pos-carousel").owlCarousel({
center: true,
items: 1,
loop: true,
margin: 15,
nav: true,
responsive: {
640: {
items: 2,
autoWidth: true,
margin: 30
}
}
});
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句