I'm having trouble using Slick JS , I'm creating a list of images I bring from the database with PHP.
<ul id="imagemProdContainer" class="imagemProdContainer">
<?php
if(!empty($galeria)):
foreach($galeria as $foto):
?>
<li data-legenda="<?=$foto->legenda;?>">
<button href="#" id="btnFechaProd" class="btnFechaProd">X</button>
<img src="assets/uploads/<?=$foto->imagem;?>" alt="<?=$foto->legenda;?>">
<span><?=$foto->legenda;?></span>
</li>
<?php
endforeach;
endif;
?>
</ul>
This is a modal that stays with display none, and only appears when I click on a gallery of thumbnails, which in turn is also a slick (thumbnails to click and open the modal):
ButwhenIclickonanyoftheimages,whatreturnsmeisthemodalwiththeimageloadedonlyintheDOM,butnotinthewindowitself:
WhenIhavesomeinteractionlikeresize,movetothenextslideorclicktheimageappears:
HereistheJavaScriptdeclaration:
//GaleriaDetalhe/AmpliaProdutos{(function(){$('#galeriaProdutosli').on('clicktouch',function(event){varmodalImagem=$('#imagemProdContainer'),index=$(this).data('slide');setTimeout(function(){modalImagem.addClass('active');},8);setTimeout(function(){$('#imagemProdContainer').slick('slickGoTo',index);},5);});$('#imagemProdContainer').on('clicktouch',function(event){varidModal=$(this).attr('id');if(idModal==event.target.id){$(this).removeClass('active');}});})();}//FecharGaleriaDetalhes/AmpliaProdutos{(function(){btnFecharDetalhe=$('.btnFechaProd');btnFecharDetalhe.on('clicktouch',function(e){e.preventDefault();$('#imagemProdContainer').removeClass('active');});})();}//SlickGaleriaDetalhe/AmpliaProduto{$('#imagemProdContainer').slick({fade:true,arrow:true});}
Iaddedasettimeouttoseeifitsolvedandnothing,Itriedtochecktheloadoftheslickwithonloadandnothing,I'mdevelopingandthesiteisontheairinatemporarylink,thisisthelinktothepagewiththeprobleminquestion:
link
I hope you can help me.