如何停止 Scriptaculous 中的闪烁?
我正在一个页面上运行此脚本,当您将鼠标悬停在该页面上时,该页面会显示一个包含更多信息的框。
脚本运行良好,只是在实际缩放之前框会闪烁。 是什么原因造成的?我在主导航中使用相同的东西并进行相同的轻拂。
有什么想法造成这个吗?
//work page springing box
$$('.box').each(function(s) {
var more = $(s).down(2);
$(s).observe('mouseenter', function(e) {
$(more).show();
new Effect.Scale(more, 100, {
scaleX: false,
scaleY: true,
scaleContent: false,
scaleFrom: 1,
mode: 'absolute',
duration: 0.5
});
});
$(s).observe('mouseleave', function(e) {
new Effect.Fade(more, {
duration: 0.2
})
});
});
谢谢。 丰富
- 我应该注意,我正在 Safari 4.0.4 中测试
I'm running this script on a page which shows a box with more information when you roll over it.
The script works fine, except theres a flicker of the box before it actually scales.
What is causing this? I use the same thing in the main navigation with the same flicking.
Any ideas whats causing this?
//work page springing box
$('.box').each(function(s) {
var more = $(s).down(2);
$(s).observe('mouseenter', function(e) {
$(more).show();
new Effect.Scale(more, 100, {
scaleX: false,
scaleY: true,
scaleContent: false,
scaleFrom: 1,
mode: 'absolute',
duration: 0.5
});
});
$(s).observe('mouseleave', function(e) {
new Effect.Fade(more, {
duration: 0.2
})
});
});
Thanks.
Rich
- I should note, I am testing in Safari 4.0.4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
@艾伦是正确的。当您调用
$(more).show();
时,会显示整个框。然后,当您调用new Effect.Scale(more
) 时,该框会向下滑动并滑入。因此$(more).show();
是导致闪烁的原因。你可以尝试:@Allen is correct. When you call
$(more).show();
The entire box is shown. Then, when you callnew Effect.Scale(more
the box is scalled down and slide in. So$(more).show();
is what's causing the flickering. You could try:该网站对我来说看起来不错。我确实注意到了一些东西,但这可能是我的想象。
不过,您可能想尝试一下,它似乎显示了它,然后更新它,如代码所示。先更新,再展示。
Firefox,顺便说一句,完全更新了。
The site looks fine to me. I did notice a very little something, but it could be my imagination.
You may want to try this though, it seems to show it, then update it, as the code says. Update it first, then show it.
Firefox, fully updated btw.