javascript fit image to box

Posted by Manna on Stack Overflow See other posts from Stack Overflow or by Manna
Published on 2012-09-12T21:15:12Z Indexed on 2012/09/12 21:38 UTC
Read the original article Hit count: 207

Filed under:
|
|
|
|

I need to make my image fitting into my div, I want the picture to be only inside the div, the rest of the picture will be behind the other elements.

Basically I want to achieve the same effect as here http://tommywebdesigner.com/Home%20Page.html but with the div id="background"and div id="content" i have created.

As you can see first i gave margin-bottom="350px to the header in order to create a blank space, here i have the space for the img in my div id="background"which is located under (z-index: -1;) and the rest of the elements is placed over inside the the div id="content" (z-index:2;)

I need now a Javascript which fit this image in the div id="background". Now the image is not located between the menu-bar and the rest of the elements Here you can look: http://fiddle.jshell.net/CGJmE/10/

Here the effect i want to achieve playing with these div : http://tommywebdesigner.com/Home%20Page.html

The reason why i want to do like that is beacuse in the future maybe i will need to put a video there and i couldn do with background-image as i have done here

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery