1
I have the following code to automatically change image in Javascript.
I wanted to use it to leave as a gif, without losing the quality.
var index = 1;
function changeImage(){
var rand = Math.floor (Math.random () * 4)
jQuery('.img-rand').hide();
jQuery(jQuery('.img-rand').get(index)).fadeIn();
index++;
if (index > 3){
index = 0;
}
}
setInterval(changeImage, 500);
.img-rand{
display:none;
}
<div class="imagemconjunto ">
<img class="img-rand" src="{{media url="wysiwyg/Paginas/kitbody/profissoes.png"}}" alt="" />
<img class="img-rand" src="{{media url="wysiwyg/Paginas/kitbody/profissoes2.png"}}" alt="" />
</div>
But it is a very broken effect. Does anyone know a way to leave with a gif aspect? In the case is the same image, just click here and click on the other without.
While analyzing your problem, I’m thinking that you just need to resize the images to be the same size, so this breaking effect will fade
– riki481
Worse than not, if you look at the bottom of the page you will see what I’m talking about https://www.boutiqueinfantil.com.br/testing
– JVEUZEBIO