Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
Slick slider navigation with next, previous, paging info and toggle for autoplay, is there a better way to integrate the toggle?

I am trying to make a slick slider with next and previous arrows, paging info and a toggle for autoplay. I have everything working except if you have selected autoplay and then click the previous arrow, the autoplay toggle now longer works.

Here is my js so far:

var $status = $('.pagingInfo');
var $slickElement = $('.slideshow');

$slickElement.on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) {
 
  if(!slick.$dots){
    return;
  }

  var i = (currentSlide ? currentSlide : 0) + 1;
  $status.text(i + ' of ' + (slick.$dots[0].children.length));
});

$slickElement.slick({
    infinite: false,
    slidesToShow: 1,
  autoplay: false,
    autoplaySpeed: 1000,
    speed: 300,
  dots: true,
            pauseOnFocus: false, 

    prevArrow: $('.prev'),
      nextArrow: $('.next'),
});

$('#toggle1').click( function() {
  if ($(this).html() == 'pause'){
    $slickElement.slick('slickPause')
     $(this).html('play') 
  } else {
    $slickElement.slick('slickPlay')  
    $(this).html('pause') 
  }  
});

Here is the slider so far: https://codepen.io/wjgoodman/pen/GRMEvpQ

Does anyone know how to better integrate the toggle so the toggle works after clicking a next or previous arrow?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!