.show(“快”) 不起作用
我这里有一个脚本,它可以使 div 的高度发生变化,然后在标签出现后进行动画处理。在此之下,我返回 false,因此下一页不会加载。
它在这样的情况下工作
$("label#error-username_r").show();
return false;
但是当我设置持续时间时它会忽略它,并忽略返回 false 并加载下一页,如下所示:
$("label#error-username_r").show("fast");
return false;
这是所有代码:
$("div#cover").animate
({
height: window.innerHeight*0.8
}, {queue:false, duration:300, easing:"backEaseInOut"}
);
$("div#cover-bottom").animate
({
height: window.innerHeight*0.2
}, {queue:false, duration:300, easing:"backEaseInOut"}
);
$("label#error-username_r").show();
return false;
I have got a script here that animates a div changing height, then after a label should appear. Under that I have return false so the next page doesn't load.
It works when it is like this
$("label#error-username_r").show();
return false;
However when I set the duration it ignores it, and ignores the return false and loads the next page like this:
$("label#error-username_r").show("fast");
return false;
Here is all of the code:
$("div#cover").animate
({
height: window.innerHeight*0.8
}, {queue:false, duration:300, easing:"backEaseInOut"}
);
$("div#cover-bottom").animate
({
height: window.innerHeight*0.2
}, {queue:false, duration:300, easing:"backEaseInOut"}
);
$("label#error-username_r").show();
return false;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果没有 HTML,很难找出真正的问题。我不认为这是因为
show("fast")
在这里失败了。一定是其他一些行为不正确的代码。您可能想尝试将持续时间作为传递参数,如下所示
但我怀疑这是否能真正解决您的问题,正如我之前所说,错误很可能出现在代码的其他地方。
无论如何,我建议您尝试 Firebug 或任何其他 Web 开发检查 js 错误并查看错误消息的工具。
It's kinda hard to dig out the real problem without HTML. And I don't think it's because
show("fast")
failed here. It's gotta be some other code that behaved incorrectly.You might want to try the duration as the passing parameter, like this
But I doubt that would really solve your problem either, as I said earlier, the error most likely is in somewhere else of your code.
Anyway, I'd suggest you try Firebug or any other web development tools to inspect the js errors and see what the error messages are.
我自己有时也注意到类似的行为。我开始把我的价值观写成:
这对我来说总是有效的。
I've noticed similar behavior myself on occasion. I started putting my values in as:
This always works for me.