我正在開發一個網站並使用下面的代碼.Chrome似乎工作正常,但Firefox不讀取負邊距,IE完全無法正確加載:負邊距在非Chrome瀏覽器中無法正確顯示
背景形式:
<div class="pageB" style="opacity:0.8;position: fixed; height: 100%; width: 100%; top: 0; left: 0; background-color: #000000; z-index: 200; display: none; font-weight: bold; color: White; font-size: 16pt;direction: rtl;">
<div class="userlogin">
<div id=top>
<div class=s1></div>
<div class=s2></div>
<div class=s3></div>
<div class=s4></div>
</div>
<div id=round>
<div align="right" dir="rtl" style="float: right;"><img src="/Files/close.png" width="24" style="cursor: pointer;" onclick="AnimateBoxBack()"></div>
</div>
<div id=bottom>
<div class=s4></div>
<div class=s3></div>
<div class=s2></div>
<div class=s1></div>
</div>
</div>
</div>
主要形式:
<div class="login-box">
Username :
<input type="text" style="width: 99%;" name="username" class="username" onfocus="AnimateBox()" /><br />
Password : <input style="width: 99%;" type="password" name="password" class="password" onfocus="AnimateBox()" /><br />
<input type="radio" name="chkAdm" class="chkAdm" id="admin" checked="checked">Admin
<input type="radio" name="chkAdm" class="chkAdm" id="user">User<br /><br />
<button class="rounded" onclick="Login()"><span>Login</span></button>
</div>
的JavaScript代碼動畫它:
function AnimateBox()
{
$(".PageB").css("display","block");
$(".login-box").css("position", "fixed");
$(".login-box").css("z-index", "300");// : "300"
$(".login-box").animate({
"top" : "50%",
"left" : "50%",
"margin-top" : "-140px",
"margin-left" : "-175px"
},1000);
loginAnimated = true;
}
在此先感謝
在http://jsfiddle.net/ – Sotiris
上創建一個演示你正在測試的IE版本(IE6不支持'position:fixed'; IE6,7,8不支持'opacity' ) – Spudley