Home  >  Article  >  Web Front-end  >  Solution to page deformation caused by using position in IE6 (js code)_javascript skills

Solution to page deformation caused by using position in IE6 (js code)_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:12:15973browse

As shown in the picture:


Solution:
1. When scaling the form, first get the blank width on the left side of the content.
$("#nav").offset().left; Get the blank width on the left side of the content area.
2. Get the width of the entire form (note: the desktop resolution is the basis, any less will be added).
3. Use the width of the desktop resolution - the width of the page content area/2 to get the extra width on one side.
4. If the value obtained is different from the value obtained by $("#nav").offset().left;, you can adjust the two values ​​to be the same.
Copy code The code is as follows:

var ietest=function()
{
if ($.browser.msie) {
if ($.browser.version == "6.0")
{
var _width=document.documentElement.clientWidth 29; //Desktop resolution size
$("#nav").css("left",((_width-950)/2)-15); //Reset value
return false;
}
return false;
}
return false;
}
window.onresize=ietest; //Event triggered when scaling the window
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn