Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slick Slider (Ken Wheeler) - Hide Slider until Loaded

I am currently using Slick (Ken Wheeler) slider function. It is currently on being loaded within the footer with only two variables.

        $('.slickSlider').slick({
              dots: true,
              fade: true
        });

I am currently experiencing the ready functionality of jquery where i can see everything breaking until the jquery is loaded. Is there anyway to hide the slider or to fix this issue? where it loads first or it doesnt load anything until all assets are done.

Thanks in advance.

like image 231
jagmitg Avatar asked Jul 09 '14 16:07

jagmitg


People also ask

How do you get the current slide on slick slider?

slick({ lazyLoad: 'progressive', onAfterChange: function(slider,index){ console. log(???); } }); Where slider returns the carousel object and index returns the current slide.

What is breakpoint in slick slider?

Breakpoints are the pixel values where Smart Slider changes to show a different layout. For example, you can use breakpoints to make the slider switch to tablet view below 1199px screen width.


1 Answers

Put a class on your slider element and set it to display:none. In your css, add

.slick-initialized{ 
    display: block 
}

An even better way would be to add opacity:0 to your slider element class, and then add

.slick-initialized{
    opacity:1;
    transition:opacity .3s ease-out;
}

to your css.

like image 134
Peter Koopman Avatar answered Oct 02 '22 03:10

Peter Koopman