0
I have a div and I want it to decrease when the user decreases the screen. I have something similar to the width, I did so: ($(window).width() -320)
it takes the total width of the screen and decreases 320px. With the height I do not know how to do.
Someone’s already done it?
For example, I have the div fundo1
and when the user decreases the window, by the browser itself, the div decreases also.
Do you want to make a recursive layout right? Have you tried bootstrap ? Com makes it much easier to do these things with his classes.
– Érik Thiago
Use a grids system such as 960.Gs or twitter bootstrap...
– Marcelo Aymone
The site is already ready :) I was only asked to make this div decrease after I finished. I mean, I will not use Bootstrap. I’m looking for something in Jquery, only I’m missing the necessary knowledge now.
– Felipe Viero Goulart
You can do with
height
relative, via CSS itself:– Beterraba
@Beets how? I was trying
function resizeFundo1(){
 var telaAltura = $(window).height();
 $('.fundo1img').css({'height': telaAltura + 'px'});
}
but it did not happen– Felipe Viero Goulart
If you set your div with relative height (
height: 90%
, for example), she will occupy 90% of the height set on her father.– Beterraba
@Beet but that’s not what I need. I need that
div
decrease as user moves screen size.– Felipe Viero Goulart
Behold this fiddle.
– Beterraba
Thanks to @Beterraba
– Felipe Viero Goulart