Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Div dimension limited by IE8?

Status
Not open for further replies.

portlive

Programmer
Mar 21, 2009
2
CN
Dear All,
I'm coding a map js, it works well with IE6.0 and 7.0, however, when I run it with IE8, some errors occur.
hera are some code inside the js.

var _zoomSizes = [["256px","256px"],["512px","512px"], ["1024px","1024px"], ["2048px","2048px"], ["4096px","4096px"], ["8192px","8192px"], ["16384px","16384px"], ["32768px","32768px"], ["65536px","65536px"], ["131072px","131072px"], ["262144px","262144px"], ["524288px","524288px"], ["1048576px","1048576px"], ["2097152px","2097152px"], ["4194304px","4194304px"], ["8388608px","8388608px"], ["16777216px","16777216px"], ["33554432px","33554432px"], ["67108864px","67108864px"], ["134217728px","134217728px"]];

function setZoom(zoom) {
var innerDiv = document.getElementById("innerDiv");
innerDiv.style.width = _zoomSizes[zoom][0];
innerDiv.style.height = _zoomSizes[zoom][1];
alert(zoom+" "+innerDiv.style.width +" "+ innerDiv.style.height);
this.zoom = zoom;
};

You may note that there is alert statement inside the function setZoom(zoom),when the zoom is below 12 inclusive, the alert shows the function works well, while the zoom is greater than 12,say 13, the alert returns
13 1342177.27px 1342177.27px
while it should be
13 2097152px 2097152px
Same occurs when I zoom to 14,15,....
This situation seems mean that when we set a div's width or height with a number greater than a specific value, then the div's width or height will be reset to a limited value by IE8. Am I right? who know how to resolve this problem?

Thanks

HQY
 
I don't know about a maximum width / height for elements in IE8, but perhaps there is another way to achieve your goal?

If you're writing some sort of magnifier for your map, why not only show a portion of the map when zooming instead of the whole thing?

For example, show a 500x500 zoomed area at any magnification, instead of zooming the whole map (which I'm assuming you do, so I could have this all wrong).

Doing this would probably offer better performance, as I don't think anyone could reasonably expect an element of 134,217,728 x 134,217,728 to actually be rendered correctly by any browser, let alone be viewed effectively (that's the width of 69905 full-res HD monitors!)

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Hello Dan,
Thanks for your reply.
I'm writing a js map render like google map.In our code,there are two divs, one called innerdiv and another called outerdiv. outerdiv is a window on innerdiv and only map tiles in outerdiv is shown to the users. when zoom in, the dimension of innerdiv become bigger while the dimension of outerdiv is not changed.That means the innerdiv is a background div, and only part of it is rendered to the users, so it will not lessen the performance.
As you mentioned, we can only magnify a specified map zone,but it will make the code more complex.
Sorry for possible obcure.

HQY
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top