tags:

views:

190

answers:

4

Hi,

I have a page with many divs and style, with my div buried somewhere inside.

I am trying to have a button that automatically makes my div, that includes a video player, resize and capture the whole browser.

In order to do that I am trying to get the current position of the div and then position it relatively so that it'll get to the top-left corner so I could then use document.body.clientHeight/clientWidth.

Can't get this to work.

I tried the approach of moving my div to the first div and then resizing however this messes up the flash player.

Any ideas? any different approaches?

Thanks,
Guy

A: 

Why relative? You should rather use fixed instead of relative. Then set positon to 0,0 and width and height to 100%. Simple js can do this.

kubal5003
All these position fixed solutions work in FireFox but in IE7 they have problems in my page, some of the divs still remain above it.
guytom
What about z-index?
kubal5003
I use it but the issue is the positioning
guytom
+2  A: 

Use one of the lightbox clones that can handle DIVs. They usually copy the DIV in question into their own view DIV, which helps with positioning issues and you don't have to do anything to the buried div.

I find Multi-Faceted lightbox to be very easy for customizations:

http://www.gregphoto.net/lightbox/

but there are lots of others around as well.

Pekka
I would try a jQuery lightbox clone. But +1 for using a lightbox tool.
David
It looks nice but as I understand it loads the content again, so my flash video player gets reloaded which is undesired. If I wouldn't mind the flash reloading I could play with the div location in the DOM as I wrote above
guytom
If you embed the flash movie into the div, moving that into the lightbox shouldn't reload. Are you sure it does that?
Pekka
A: 

On click, just set the div's style to 'fixed', and position 0,0. Like:

var theDiv = document.getElementById('yourDivsId');
theDiv.style.position = 'fixed';
theDiv.style.top      = 0;
theDiv.style.left     = 0;
umbrae
A: 

This should do the trick:

<div style="position:absolute;top:0;left:0;width:100%;height:100%">
   some content here
</div>
jerjer
Same as with fixed, it doesn't work well in IE when the div is buried...
guytom