How to Add My Slide Button

Asked

Viewed 258 times

1

I started studying HTML and CSS now. But I need to do a slide and I found a note ready, but I needed it to have those little round buttons underneath centered in the middle. It’s for the mobile version. Someone would know how to?

<script type = "text/javascript" > // <![CDATA[
  $(document).ready(function() {
    $('.customer-logos').slick({
      slidesToShow: 4,
      slidesToScroll: 1,
      autoplay: true,
      autoplaySpeed: 1500,
      arrows: false,
      dots: false,
      pauseOnHover: false,
      responsive: [{
        breakpoint: 768,
        settings: {
          slidesToShow: 3
        }
      }, {
        breakpoint: 520,
        settings: {
          slidesToShow: 1
        }
      }]
    });
  });
// ]]></script>
<style><!-- div#banner {}

.banner img {
  margin-bottom: 20px;
}


/* Slider */

.slick-slide {
  margin: 0px 5px;
}

.slick-slide img {
  width: 100%;
}

.slick-slider {
  position: relative;
  display: block;
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -khtml-user-select: none;
  -ms-touch-action: pan-y;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}

.slick-list {
  position: relative;
  display: block;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.slick-list:focus {
  outline: none;
}

.slick-list.dragging {
  cursor: pointer;
  cursor: hand;
}

.slick-slider .slick-track,
.slick-slider .slick-list {
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -ms-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
}

.slick-track {
  position: relative;
  top: 0;
  left: 0;
  display: block;
}

.slick-track:before,
.slick-track:after {
  display: table;
  content: '';
}

.slick-track:after {
  clear: both;
}

.slick-loading .slick-track {
  visibility: hidden;
}

.slick-slide {
  display: none;
  float: left;
  height: 100%;
  min-height: 1px;
}

[dir='rtl'] .slick-slide {
  float: right;
}

.slick-slide img {
  display: block;
}

.slick-slide.slick-loading img {
  display: none;
}

.slick-slide.dragging img {
  pointer-events: none;
}

.slick-initialized .slick-slide {
  display: block;
}

.slick-loading .slick-slide {
  visibility: hidden;
}

.slick-vertical .slick-slide {
  display: block;
  height: auto;
  border: 1px solid transparent;
}

.slick-arrow.slick-hidden {
  display: none;
}

--></style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.js" type="text/javascript"></script>
</p>
<div class="banner"><img alt="" src="{{media url=" wysiwyg/teste/categorias/kitbody.png "}}" /></div>
<div class="customer-logos">
  <div class="slide">
    <a href="/roupas-de-bebes/departamento/bermuda+calca+mij_o"><img alt="" src="{{media url=" wysiwyg/teste/categorias/Mijoes.png "}}" /></a>
  </div>
  <div class="slide">
    <a href="/higiene-bebe"><img alt="" src="{{media url=" wysiwyg/teste/categorias/Higiene.png "}}" /></a>
  </div>
  <div class="slide">
    <a href="/alimentacao-bebe"><img alt="" src="{{media url=" wysiwyg/teste/categorias/alimenta_o.png "}}" /></a>
  </div>
</div>

1 answer

1


By the Javascript CDN link you posted in the question it seems that you are using the slider plugin Slick-Carousel http://kenwheeler.github.io/slick/

In the documentation for you to activate the "navigation balls" the dots should be like true (dots: true)!

See the script below how it should be configured, note where I left the comment.

$(document).ready(function() {
    $('.customer-logos').slick({
      slidesToShow: 4,
      slidesToScroll: 1,
      autoplay: true,
      autoplaySpeed: 1500,
      arrows: false,
      dots: true,            //aqui deve ser TRUE e não FALSE como estava...
      pauseOnHover: false,
      responsive: [{
        breakpoint: 768,
        settings: {
          slidesToShow: 3
        }
      }, {
        breakpoint: 520,
        settings: {
          slidesToShow: 1
        }
      }]
    });
  });
  • Thank you very much, you solved my problem!

  • @I’m glad it worked out! If my answer helped you in any way consider marking it as Accept, in this icon below the arrows on the left side of my answer :) so the site does not get open questions pending without response accepted.

  • right, I’ll mark, just one more question the slidesToShow: 3 is responsible for how many images show at once ?

  • @JVEUZEBIO yes. And that end of the code means that when the screen is 768px it shows 3 imgs, and when the screen is 520px wide it will show 1 img. For screens larger than 768px this will be 4 imgs as it is at the beginning of the slidesToShow: 4,

Browser other questions tagged

You are not signed in. Login or sign up in order to post.