我在图像转盘中有3张幻灯片,并且我想将class id动画和bounceInDown添加到具有Ids melon-fruta,frutilla-fruta和banana-fruta的3个img标签中,当我在控制台中记录该元素时,工作正常,但在开发人员工具的“元素”选项卡中,属性未显示在img标签中。
var owl = $('.carrousel .owl-carousel');
owl.owlCarousel();
// Listen to owl events:
owl.on('changed.owl.carousel', function (event) {
var page = event.page.index;
if(page == 0){
console.log(page);
const element = document.getElementById("melon-fruta");
element.classList.add('animated', 'bounceInDown','delay-1s');
console.log(element);
}else if(page == 1){
const element = document.getElementById("frutilla-fruta");
element.classList.add('animated', 'bounceInDown','delay-1s');
console.log(element);
}else if(page == 2){
const element = document.getElementById("banana-fruta");
element.classList.add('animated', 'bounceInDown','delay-1s');
console.log(element);
}
});