C# jqueryanimate在IE和Firefox中都非常慢
我正在使用jQuery animate()函数来显示一个小文本,它越来越大,直到消失 我这里有jQuery代码:C# jqueryanimate在IE和Firefox中都非常慢,c#,asp.net,jquery,ajax,internet-explorer,C#,Asp.net,Jquery,Ajax,Internet Explorer,我正在使用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:
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);
string script=“$('#block').html('Yes!
“+xpReward.ToString()+“xp!”);
RegisterStartupScript(ButtonListUpdate,typeof(string),“启动”,
“xpGain();”+脚本,true);
每次我在RadioButtonList(ASP.NET)中选择一个选项时,都会运行此代码
现在,我有这个问题:
- Chrome-效果非常好
- Safari-效果非常好
- iPhone浏览器-正常工作
- Internet Explorer-可怕
- Firefox-有时很棒,有时很糟糕
LAR只是一个想法-您正在使用
%
、em
、px
和作为度量单位。也许如果你只对一个测量单位进行标准化,事情可能会进展得更快。我真的不知道,只是猜测一下
此外,在动画完成时运行的函数中,可以将$(“#block”)元素上的所有动作链接在一起,例如
$("#block").removeAttr("style").html("").css("color", "White").css("position", "absolute").css("z-index", "-5");
一些oldscool浏览器在0下的z索引存在问题 谢谢-没有让它更快。。但总的来说——好主意!:-)
$("#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'});