我正在使用jQuery animate()函数来显示一个越来越大的小文本,直到它消失。
我在这里有jQuery代码:
function Gain() {
/* Using multiple unit types within one animation. */
$("#block").animate({
width: "80%",
opacity: 0.0,
marginLeft: "2.6in",
fontSize: "15em",
borderWidth: "10px"
}, 2000, function () {
$("#block").removeAttr("style");
$("#block").html("");
$("#block").css("color", "White");
$("#block").css("position", "absolute");
$("#block").css("z-index", "-5");
});
}
我用来触发函数的代码:
string script = "$('#block').html('Yes!<br/>" + xpReward.ToString() + "xp!');";
ScriptManager.RegisterStartupScript(ButtonListUpdate, typeof(string), "startup",
"xpGain(); " + script, true);
每次我在RadioButtonList(ASP.NET)中选择一个选项时都会运行此代码。
现在,我遇到了这个问题:
我想忽略Internet Explorer,但由于它们拥有非常大的市场份额,我必须处理这个问题。
您可以自己尝试动画
所以我的问题是......
如何在Internet Explorer中使用此功能?现在它太可怕了。我不指望它能够很好地工作,但只是“可玩”才真的很棒......
非常感谢! 拉斯
答案 0 :(得分:1)
只是一个想法 - 您使用%
,em
,px
和in
作为衡量单位。也许如果您只对一个测量单位进行标准化,事情可能会更快。我真的不知道,只是猜测。
同样在动画完成时运行的函数中,您可以将$('#block')元素上的所有动作链接在一起,例如:
$("#block").removeAttr("style").html("").css("color", "White").css("position", "absolute").css("z-index", "-5");
答案 1 :(得分:1)
$("#block").animate({
width: "80%",
opacity: 0.0,
marginLeft: "2.6in",
fontSize: "15em",
borderWidth: "10px" }, 2000)
.removeAttr("style")
.html("")
.css({color: '#fff', position:'absolute', z-index:'-5'});
某些oldscool浏览器的z-index在0以下有问题!