I have a problem with space in some divs, here is the code below:
HTML:
<div id="feira">
<div class="barraca"></div>
<div class="barraca"></div>
<div class="barraca"></div>
</div>
CSS:
#feira{
position: fixed;
right: 0;
bottom: 0;
z-index: 55;
width: 80%;
}
.barraca{
position: absolute;
right: 0;
bottom: 0;
background: #AAA;
width: 250px;
height: 200px;
}
Now to leave the tents separate I'm using this algorithm in Jquery, but it's not working, because the 2nd booth it says it has left: 0; and one tent is behind the other.
Jquery:
function organizar(){
qtdJanela = $(".barraca").size();
if(qtdJanela > 1){
for(c = 0; c < qtdJanela; c++){
janela = $(".barraca").eq(c);
posJanela = janela.position();
distancia = posJanela.left;
alert(distancia);
$(".barraca").eq(c+1).css({'right':distancia+'px'});
}
}
}
It has an hour that it displays 0 in the distance.