0
I’m having a problem for space on some Divs, follow 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 he says has the left: 0; and one of the tents 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'});
}
}
}
There’s a time he shows 0 in the distance.
But why are you using an algorithm in jQuery ? you can do this with pure css.
– Lucas Fontes Gaspareto
because I need it to be fixed at the bottom, chat style of the face, because I will minimize the window and only the title will be displayed. Relative position is not fixed at the bottom.
– Romario Pires
But if you want to do the same as facebook chat you will have to use
position: fixed;
nayrelative;
.– Lucas Fontes Gaspareto
Yes I know, the main div is Fixed, but the windows need to look like Absolute to stay with the bottom 0.
– Romario Pires
Of course not, if you define the
bottom: 0px
indiv
father who isfixed
will stay on the footer. Take a look at this example I did on jsFiddle. You can also choose the specification Flexible box– Lucas Fontes Gaspareto
It looks like in what I want to use http://jsfiddle.net/f5x2tqad/. If I leave without absotute, see what happens when minimizing the window!
– Romario Pires
I get it, in case someone can’t find an answer to your problem, when I have time, I’ll develop a lean, performative solution.
– Lucas Fontes Gaspareto
Okay, thank you! ^^
– Romario Pires
@Romariopires, is this what you want? https://jsfiddle.net/TobyMosque/17sj3oxp/
– Tobias Mesquita
made an update to the script: https://jsfiddle.net/TobyMosque/17sj3oxp/1/
– Tobias Mesquita
Vlw guy I managed to solve already. What I needed is to stay fixed at the bottom of the screen, can not leave even giving scroll.
– Romario Pires