Jquery change background-image properties in body <tag>
How can I change background-image properties in body...
CSS CODE:
body
{
background-image:url('...');
repe开发者_如何转开发at:repeat-x;
height:100%;
}
How can I make the height value to be dynamic...(changing the height for diffrent screen sizes)?
My idea is to use Jquery to get a screen height value: $(window).height();
But i don't really understand what to do with that in the CSS CODE...
I don't really understand why height:100%
doesn't do the job.
You should also set height: 100% to the HTML tag then it will work. For example add the following like to your CSS:
HTML, BODY { height: 100%; }
height:100%
doesnt always behave the way you might expect, especially once the designs start getting more complicated. If adjusting the height isnt doing it for you, you may want to consider checking out the $(window).scroll()
event. There, you can manually calculate and set the exact height that you need your page to be.
精彩评论