1

I'm trying to show a tooltip when you hover your mouse on a day in a calendar control.

I'm using the mouseenter/mouseleave event to fadeIn/fadeOut respectively. This works.

However, my problem is since it's a calendar, there will be many days and when I'm moving my mouse across the whole week, the fadeIn/fadeOut (or show/hide) will all happen in sequence, until all events are completed... there is some sort of lag because they are happening all in sequence.

What would be the best way to prevent this from happening?

4

4 回答 4

2

查看这个名为hoverIntent的 jQuery 插件......它应该可以解决您的问题。

于 2009-08-10T14:59:46.387 回答
1

If you have a parent container around your week, you could just do the effect on that item.

于 2009-06-12T21:03:57.047 回答
1

I suggest that you handle just an event for all the week and then detect which day has been selected

于 2009-06-12T21:05:18.820 回答
0

我会添加一些逻辑来检查是否已经显示了工具提示,如果是,请移动它并更新文本。

困难的部分是添加逻辑以确保fadeOut仅在文本没有更改时才会发生。首先要做的是在淡入淡出之前添加一个小的延迟setTimeout。其次,创建一个每次更新工具提示文本时递增的变量。最后,确保对 setTimeout 的每次调用都包含整数的副本,并且在调用淡入淡出之前,检查整数没有改变。

于 2009-06-12T21:29:27.280 回答