0
I’m developing an application with bootstrap and I’m using its carousel, but this carousel has text and will have different audio on each slide, but I don’t want to click on each indicator and recognize when the active class is on a particular slide, follow the example the code I made.
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators3" data-slide-to="0" class="desbloquear active somslide1"></li>
<li data-target="#carouselExampleIndicators3" data-slide-to="1" class="desbloquear somslide2"></li>
<li data-target="#carouselExampleIndicators3" data-slide-to="2" class="desbloquear somslide3"></li>
<li data-target="#carouselExampleIndicators3" data-slide-to="3" class="desbloquear somslide4"></li>
<li data-target="#carouselExampleIndicators3" data-slide-to="4" class="desbloquear somslide5"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<p>texto</p>
<div class="audio2"></div>
</div>
</div>
<script>
$('.somslide2').on('click',function(){
$('.audio2').html('<audio id="som1" autoplay><source src="audio/CIPA.wav" type="audio/mpeg"></audio>');
});
</script>
It didn’t work because he doesn’t recognize play as a function
– Thi100
That’s why I said "// or something"... Because you’re already accessing the object, now you just have to give the play.. It’s up to you.. since I don’t have your code... right? If you want.. put in a JS BIN of life and show me your code and I try to help you.
– José Junior