0
I would like to know how to solve the following case.
I have a structure like this:
<section class="portfolio slide" id="portfolio">
    <h2>portfólio.</h2>
    <div id="foto">
        <img src="images/img-1.jpeg" alt="imagem 1" />
    </div>
    <div id="foto">
        <img src="images/pexels-photo.jpg" alt="imagem 2" />
    </div>
    <div id="foto">
        <img src="images/img-1.jpeg" alt="imagem 3" />
    </div>
    <div class="botao">
        <a href="#" class="botao-portfolio">
            <i  class="far fa-eye"></i>
            veja mais.
        </a>
    </div>
</section>
I want to make a slider that alters the photos in <div> with the id="foto", but my code is "catching" the <div> with the class="botao". I wonder if it is possible not to "catch" last <div>. Thank you!
Follow the jQuery code:
function slider(sliderName) {
    var sliderClass = '.' + sliderName,
        activeClass = 'active';
    $('.slide > #foto:first').addClass('active');
    function rotateSlide() {
        var activeSlide = $(sliderClass + ' > .' + activeClass),
            nextSlide = activeSlide.next();
        if(nextSlide.length == 0) {
            nextSlide = $(sliderClass + ' > :first');
        }
        activeSlide.removeClass(activeClass);
        nextSlide.addClass(activeClass);
    }
}
slider('portfolio');
Matheus, paste as code into the question, then mark with the mouse and press the button { } (or press control K). Or, add four spaces at the beginning of each line of code.
– Bacco