通过添加或删除class类名,达到动态操作css伪类的效果
$('.items').on('hover','li',function(){
const currentIndex = $(this).data("index");
$(this).addClass('item_2X');
$(this).siblings().removeClass('item_2X');
$(this).children("span").addClass('show');
$(this).siblings().children("span").removeClass('show');
$("#text").html(list[currentIndex].text);
})
.item_2X {
transform: scale(1.1);
}
.show::after {
content: "";
margin: 5px auto;
display: block;
width: 25px;
height: 5px;
background-color: #ffcd40;
border-radius: 10px;
}