I want to make three element below the carousel change during slideshow. To indicate the specific slide that corresponds with the element.
I have done my research, but every time I try to implement someones code it only displays all three elements on or off. The carousel uses CSS to activate (.active
) a slide like all three slides are showing at once but you only see the one in front.
Basically, I have two images per element and they are they same but different colors so when one slide appears it should switch to the other src
image with a little js; I have done this, but it will only work with the onclick
function not when a slide is automatically selected.
By the way, my goal is to get the slides to fire each element if the user clicks on prev, next, the indicators, or during intervals. I have goten this to work in basic HTML, but bootstraps inner working seems very difficult to manipulate for me.
$(function() {
// Cycles the carousel to a particular frame when clicked and changes the img
$('#icon1').click(function() {
$("#myCarousel").carousel(0);
if ($("#myCarousel").carousel(0)) {
document.getElementById('icon1').src='icon-hover.png' //this img is blue
}
if ($("#myCarousel").carousel(0)) {
document.getElementById('icon3').src='icon3.png' //this img is black
}
if ($("#myCarousel").carousel(0)) {
document.getElementById('icon2').src='icon2.png'
}
});
//these are x3 but with different .carousel(numbers) and images in increment
// Cycles the carousel to a particular frame when clicked and changes the text color
$("#icon1").click(function() {
$("#myCarousel").carousel(0); //the 0 is the slide.index/length
if ($("#myCarousel").carousel(0)) {
$('.element1').css('color', '#1462ba')
}
if ($("#myCarousel").carousel(0)) {
$('.element2').css('color', 'black')
}
if ($("#myCarousel").carousel(0)) {
$('.element3').css('color', 'black')
}
});
//these are x3 but with different .carousel(numbers) and colors in increment
});