简体   繁体   中英

Slick edge event not triggering

I have this is script;

var $carousel = $("[data-carousel]");

$carousel.on('edge', function(event, slick, direction){
  console.log("edge");
});

$carousel.slick({
  slidesToShow: 4,
  slidesToScroll: 4,
  accessibility: false,
  draggable: false,
  infinite: false,
  prevArrow: $("[data-carousel-prev]"),
  nextArrow: $("[data-carousel-next]"),
  responsive: [
    {
      breakpoint: 1370,
      settings: {
        slidesToShow: 3,
        slidesToScroll: 3
      }
    }
  ]
});

But when reaching the edge, it does not trigger any edge event following the docs seems ok I'm using slick 1.5.6

The edge event only fires when overscrolling happens.

Such overscrolling can only happen if draggable is set to true and you drag over the last slide.

Using the buttons will not trigger the edge event.

If you are looking to execute some code if the "next" button is triggered at the last slide, use the indexes in combination with the afterChange event.

Disclaimer: used version in this answer: 1.5.9

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM