slick icon indicating copy to clipboard operation
slick copied to clipboard

Slider dots are not hidden when slides are all visible

Open ulimc opened this issue 8 years ago • 5 comments

When there is a simple carousel with (for example) 4 elements and all of them are currently visible, the dot is not automatically hidden like in previous versions.

I expect the dot(s) to only show when a fifth element is attached to the carousel.

====================================================================

See this fiddle:

[ https://jsfiddle.net/f2cf73wz/ ]

====================================================================

ulimc avatar Dec 06 '17 18:12 ulimc

Hi, same problem, I have added an "if( _.slideCount > _.options.slidesToShow ) {" from "buildArrows" function

    Slick.prototype.buildDots = function() {

        var _ = this,
            i, dot;

        if (_.options.dots === true) {

            if( _.slideCount > _.options.slidesToShow ) {

                _.$slider.addClass('slick-dotted');

                dot = $('<ul />').addClass(_.options.dotsClass);

                for (i = 0; i <= _.getDotCount(); i += 1) {
                    dot.append($('<li />').append(_.options.customPaging.call(this, _, i)));
                }

                _.$dots = dot.appendTo(_.options.appendDots);

                _.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false');

            }

        }

    };

cyril-lamotte avatar Dec 29 '17 13:12 cyril-lamotte

Maybe is worth to someone: the problem itself appears only with the minified version (v. 1.8.1) of the file. With the non minified version all is good.

ulimc avatar Apr 13 '18 17:04 ulimc

Same problem, but it works correct on not minimized script.

cyber-jet avatar Dec 16 '18 08:12 cyber-jet

Can use a workaround by hiding the ul if only one li is available. For example

.slick-dotted > ul.slick-dots {
  &:has(:only-child) {
     display: none;
  }
}

Updated the original fiddle

dhyeythumar avatar Jan 06 '25 07:01 dhyeythumar

This seems to be an issue with the old minified file that is not up to data.

Also see: #4144

markvantilburg avatar Jan 06 '25 09:01 markvantilburg