我正在使用
JavaScript来隐藏图像并显示隐藏在其下的一些文本.但是,当文本显示时,如果你滚动它,它会触发容器上的mouSEOut事件,然后隐藏文本并再次显示图像,它只是进入一个奇怪的循环.
html看起来像这样:
和javascript(它使用scriptaculous):
- function jsHoverIn(id) {
- if(!visible[id]) {
- new Effect.Fade ("image" + id,{queue: { position: 'end',scope: id } });
- new Effect.Appear ("text" + id,scope: id } });
- visible[id] = true;
- }
- }
- function jsHoverOut (id) {
- var scope = Effect.Queues.get(id);
- scope.each(function(effect) { effect.cancel(); });
- new Effect.Fade ("text" + id,scope: id } });
- new Effect.Appear ("image" + id,scope: id } });
- visible[id] = false;
- }
这看起来很简单,但我无法绕过它.