我想更改DOM中活动幻灯片的CSS
.html
<ion-slides>
<ion-slide class="swiper-slide"></ion-slide>
<ion-slide class="swiper-slide active"></ion-slide> // <-- Active slide in DOM
<ion-slide class="swiper-slide"></ion-slide>
</ion-slides>
先谢谢了。
.scss
.slider_selected_text{
color : #ed1a3b
}
.slider_unselected_text{
}
答案 0 :(得分:1)
很难确定您是要向active
端添加sccs
类还是要向ion-slide
元素动态添加CSS类。我假设您正在要求scss
一方。如果不是这样,请告诉我,我将更新答案。
您可以像这样向.active
文件中添加scss
类:
.swiper-slide {
// Assuming "slider_selected_text" is covered by "swiper-slide" class
& .slider_selected_text{ // note that there is a space between & and class name
color : #ed1a3b
}
& .slider_unselected_text{
}
&.active{ // note that there is NOT a space between & and class name means this will apply to the elements having both classes
& .slider_selected_text{ // note that there is a space between & and class name
color : #ed1a3b
}
& .slider_unselected_text{
}
}
}
希望这会给您一个线索。