我正在动态地将图像添加到猫头鹰轮播中,如下所示:
var i;
for (i = 0; i < myObj.small_images.length; i++) {
var src = myObj.small_images[i];
$(".prev-owl-carousel").append("<div class='more-views-items'><a href='#' class='prevImg' data-image='" + src + "' data-zoom-image='" + src + "'><img id='product-zoom' src='" + src + "' alt='product-image'></a></div>");
}
我正在获取有效的HTML,但是猫头鹰传送带不会初始化(它没有添加特殊的类和样式)。 这是猫头鹰轮播本身的方式:
$(".prev-owl-carousel").owlCarousel({
autoplay: false,
items: 4, //10 items above 1000px browser width
itemsDesktop: [1024, 3], //5 items between 1024px and 901px
itemsDesktopSmall: [900, 2], // 3 items betweem 900px and 601px
itemsTablet: [600, 3], //2 items between 600 and 0;
itemsMobile: [320, 2],
navigation: true,
navigationText: ["<a class=\"flex-prev\"></a>", "<a class=\"flex-next\"></a>"],
slideSpeed: 500,
pagination: false
});
我需要动态添加图像并创建有效的猫头鹰轮播,这是什么问题?