Slick initializes with width:0 on all relevant elements
See original GitHub issueHi there,
in adding to the $(document).ready( function() { $('.slickPhotos').slick() })
, the script runs properly, creates all the DOM elements etc, but does not determine the correct widths until I first drag on the image.
Only when I drag on the image does the carousel seem to fully execute.
There are no console errors thrown so I’m at a loss. Thanks for the help!
Issue Analytics
- State:
- Created 9 years ago
- Comments:20 (1 by maintainers)
Top Results From Across the Web
Slick Slider Width 0 On Initial Page Load - Stack Overflow
Triggering a window resize event via JS; Setting min-height of all slick elements to 1; Putting the images in a div container. I...
Read more >kenwheeler/slick - Gitter
This plugin can custom animation to change every page like rotate or filp? Daniel Schmidt ... .slick-track and .slick-slide have width:0 set to...
Read more >Slick Slider with auto width - CodePen
URL Extension Required. When linking another Pen as a resource, make sure you use a URL Extension of the type of code you...
Read more >slick slider width 0 Code Example - Code Grepper
slick -track { display: flex !important; } .slick-slide { height: auto; }
Read more >Slick carousel slide width 0
If the viewport is greater than the unslick breakpoint, we re-initialize the slick. Slick slider width issue in mobile. The width of "slick-track"...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here is what I did to resolve the issue. I was loading slick slider with thumbnail navigation in jquery’s colorbox and was hidden by default.
Code for slick slider:
Code for refreshing the slider after colorbox was opened:
Hope this helps as I spent a while searching for the solution and this one works for me.
First of all: @kenwheeler thanks a lot for this awesome slider. 😃 its damn sexy!
To help you guys fixing this “hidden slider Problem” i found a solution at least for my project: @vinayakjo helped me a lot for that! Thank you buddy 😃
My slick slider is defined in a hidden tab too, so the width of the sliding elements cant be calculated. I fixed the problem by using this simple line of code:
$('.your_hidden_slider_class_or_id').slick("refresh");
Paste this into the function which sets the hidden element to display:block. Cheers.