0
I want to make an automatic transition between Ivs.
Example:
div1 - show();
div2 - hide();
.... 3000milisegundoss...
div1 - hide();
div2 - show();
And stay in that transition...
I’m trying to do this way, I put in a toggle()
it performs only once and to.
How to make this transition automatic/"infinite"?
$(function(){
var div1 = $('.cliente1');
var div2 = $('.cliente2');
$(document).ready(function(){
div1.show();
div2.hide();
setInterval(function(){
div1.toggle();
div2.toggle();
}, 3000);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<aside class="clients cliente1" style="border: 1px solid black">
<div class="container">
<div class="row">
DIV 1
<div class="col-md-3 col-sm-6">
<a>
Conteúdo DIV 1
</a>
</div>
<div class="col-md-3 col-sm-6">
<a>
Conteúdo DIV 1
</a>
</div>
<div class="col-md-3 col-sm-6">
<a>
Conteúdo DIV 1
</a>
</div>
<div class="col-md-3 col-sm-6">
<a>
Conteúdo DIV 1
</a>
</div>
</div>
</div>
</aside>
<aside class="clients cliente2" style="border: 1px solid black">
<div class="container">
<div class="row">
DIV 2
<div class="col-md-3 col-sm-6">
<a>
Conteúdo DIV 2
</a>
</div>
<div class="col-md-3 col-sm-6">
<a>
Conteúdo DIV 2
</a>
</div>
<div class="col-md-3 col-sm-6">
<a>
Conteúdo DIV 2
</a>
</div>
<div class="col-md-3 col-sm-6">
<a>
Conteúdo DIV 2
</a>
</div>
</div>
</div>
</aside>
No rsrs required. I found the bug. The function to be used is not the
setTimeout
, but rather thesetInterval
:)– Zkk
Still, thanks for your help!
– Zkk