I'm using Slick Slider with content in each slide (text and images):
<div id="misresenas">
<div class="resena">
<!-- my content -->
</div>
<div class="resena">
<!-- my content -->
</div>
<div class="resena">
<!-- my content -->
</div>
</div>
<script src=".12.0.min.js"></script>
<script src=".8.1/slick.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#misresenas").slick({
arrows:false,
autoplay:true
});
});
</script>
The problem is when I load page, at the beginning Slick Slider looks like this with one slide above the other until it finishes load page and then it starts working:
I tried to put these lines on CSS but It doesn't work, the slider is pletely hidden:
#misresenas{display:none;}
#misresenas .slick-initialized{display:block;}
How can I fix it?
I'm using Slick Slider with content in each slide (text and images):
<div id="misresenas">
<div class="resena">
<!-- my content -->
</div>
<div class="resena">
<!-- my content -->
</div>
<div class="resena">
<!-- my content -->
</div>
</div>
<script src="https://code.jquery./jquery-1.12.0.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#misresenas").slick({
arrows:false,
autoplay:true
});
});
</script>
The problem is when I load page, at the beginning Slick Slider looks like this with one slide above the other until it finishes load page and then it starts working:
I tried to put these lines on CSS but It doesn't work, the slider is pletely hidden:
#misresenas{display:none;}
#misresenas .slick-initialized{display:block;}
How can I fix it?
Share Improve this question edited Mar 12, 2018 at 17:22 Stephen Kennedy 21.6k24 gold badges97 silver badges112 bronze badges asked Mar 12, 2018 at 16:15 NekoLopezNekoLopez 6092 gold badges13 silver badges28 bronze badges 1-
what about adding css like
.resena { display:inline-block; }
?. – Sphinx Commented Mar 12, 2018 at 16:24
2 Answers
Reset to default 7Here you go. Replace $(document).ready()
with $(window).load()
function.
<script type="text/javascript">
$(window).on('load', function() {
$("#misresenas").slick({
arrows:false,
autoplay:true
});
});
</script>
That's the correct code
#misresenas{display:none;}
#misresenas.slick-initialized{display:block;}