当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Need help with JS positioning in IE Compatability Mode

问题描述:

I've written and tested this script in Chrome, IE 8 and FF. All works fine.

However, I found out today most clients will be using out of date browsers, so it needs to work in IE compatability mode.

IE compatability mode works OK for the most part, but it's getting the positioning wrong.

This is the main bit of code that doesn't position correctly.

// Sets bars position X

this.gSetBarX = function(gBarID, gBarX) {

if (this.gIsValidGBarID(gBarID)) {

document.getElementById("gBar" + gBarID).style.left = (gBarX) + "px";

}

}

If I alert the value in IE Compat mode it alerts 554px

In chrome it alerts as '557px'.

The difference in value isn't of much concern to me, but it's positioning the element on completely different parts of the screen.

I've measured the distance it's rendering:

Chrome: 730px from browser left, 557px from left edge of it's *containing* div

IE Compat: 1005px from browser left, ~830px from left edge of it's *containing* div

830px - 554px is a 276px difference from where it should be displayed!

I'm completely stumped. Can anyone help?

分享给朋友:
您可能感兴趣的文章:
随机阅读: