Slick: Images are visible before slik is initialized

Created on 3 Mar 2017  ·  3Comments  ·  Source: kenwheeler/slick

We initialize slick after the DOM has been completely loaded.
This leads to the fact that the slides are visible for half a scond before slick is started.
Is there a way to prevent that? Can I load images/slides but hide them until the slideshow is started?

Thanks

Most helpful comment

Make the slider initially invisible in styles. And on the class .slick-initialized add the property display of the block
Example:

Javascript

$('.slick-carousel').slick({

})

CSS:

.slick-carousel{
  display: none;
}
.slick-carousel.slick-initialized{
  display: block;
}

All 3 comments

Make the slider initially invisible in styles. And on the class .slick-initialized add the property display of the block
Example:

Javascript

$('.slick-carousel').slick({

})

CSS:

.slick-carousel{
  display: none;
}
.slick-carousel.slick-initialized{
  display: block;
}

Hi Alex,

just what I was looking for. Works great!

Thank you.
Holger

+++++++++++++++++++++++++++++++++++++++++++++++++
SitePepper Websolutions
Holger Grabowsky
Schlüterstrasse 64
20146 Hamburg
Tel: 040 - 44 50 60 80
Fax: 040 - 44 50 60 71
Email: [email protected]
+++++++++++++++++++++++++++++++++++++++++++++++++

From:      
 Alex Simonok notifications@github.com
To:      
 kenwheeler/slick slick@noreply.github.com
Cc:      
 hoghamburg hog@sitepepper.de,
Author author@noreply.github.com
Date:      
 07.03.2017 10:45
Subject:    
   Re: [kenwheeler/slick]
Images are visible before slik is initialized (#2781)

Make the slider initially invisible in styles. And on
the class .slick-initialized add the property display of the block
Example:
Javascript
$('.slick-carousel').slick({
 
})

CSS:
.slick-carousel{
 display: none;
}
.slick-carousel.slick-initialized{
 display: block;
}


You are receiving this because you authored the thread.
Reply to this email directly, view
it on GitHub, or mute
the thread.

dup

Was this page helpful?
0 / 5 - 0 ratings