Thursday, 16 September 2010

Javascripting

Today I was just working on my javascript overlay / lightbox for displaying my google map. I found that the info given on the web about how to calculate the page size or window size using javascript wasn't necessarily wrong. It seems that the problem is if you add or change something that modifies the page or window size, then check the page or window size, the browser won't yet have calculated the changes to the window / page size from your previous command.

So the solution is to make sure you leave some time between doing anything that modifies the page / window size and checking the page / window size (i.e. use a setTimeout).

I also found that IE would make a <object> element non-interactive if you move it in the DOM. (at least where the <object> is being used as an iframe containing a google maps page.

And the other browsers all return the <object> to it's default state when you move it in the DOM or set its display to none.

No comments: