question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple dots navigation

See original GitHub issue

I need dots inside every slide. I have something like that:

$('.homepage-slider').slick({
    dots: true,
    appendDots: ".slide"
});

Dots are attached correctly, but dot for current slide is marked as active only in first slide.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

24reactions
tyrann0uscommented, Sep 28, 2016

This is my Quick 'n Dirty version:

var activeClass = 'slick-active',
    ariaAttribute = 'aria-hidden';
$( '.slider' )
.on( 'init', function() {
    $( '.slick-dots li:first-of-type' ).addClass( activeClass ).attr( ariaAttribute, false );
} )
.on( 'afterChange', function( event, slick, currentSlide ) {
    var $dots = $( '.slick-dots' );
    $( 'li', $dots ).removeClass( activeClass ).attr( ariaAttribute, true );
    $dots.each( function() {
        $( 'li', $( this ) ).eq( currentSlide ).addClass( activeClass ).attr( ariaAttribute, false );
    } );
} );

$( '.slider' ).slick();

Not pretty, but it works for me.

6reactions
ianmclcommented, Sep 11, 2019

$dots is already in the slick object

.on( 'afterChange', function( event, slick, currentSlide ) {
  $.each(slick.$dots, (i, el) => {
    $(el).find('li').eq(currentSlide).addClass('slick-active').find('button');
  })
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Use And style The Divi Dot Navigation
With the Divi dot navigation your visitors can easily scroll through your page. You can style this with labels for better navigating.
Read more >
Dot Navigation Styles - Codrops
Today we want to share a set of inspirational dot navigation styles with very subtle ... For the effects we employ several techniques, ......
Read more >
Multiple navigation dots in Beamer for one frame - TeX
Now I have some frames with multiple slides (or overlays) using either \only<> or \invisible<> commands. How can I get as many navigation...
Read more >
JavaScript-Dot navigation - jquery - Stack Overflow
How can I code the Javascript or jQuery so that when I click on a dot, the dot gets an active class, but...
Read more >
Unity DOTS navigation with nav mesh query - YouTube
This was long due, but I had to try out new ways to achieve a more efficient and maintainable DOTS -based navigation system...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found