问题标签 [mouseleave]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
824 浏览

silverlight - ComboBox 未按预期引发键盘和鼠标事件

我使用 Silverlight 4.0 并且遇到了 ComboBox 控件的问题。我想实现一个弹出菜单,无需单击鼠标即可显示和隐藏自身。它应该在我将光标放在其区域上时显示 - 这个 prt 效果很好。然后,只要将鼠标指针放在其区域之外一段时间,它就应该隐藏。我用 MouseEnter 和 MouseLeave 事件实现了它。我的问题是组合框- 在我看来,这个控件的行为很奇怪。通常,当我将光标放在它上面时,我希望它会引发 MouseEnter 事件,而当我将鼠标光标放在其他任何地方时,它会引发 MouseLeave 事件。实际情况不同:每当我单击组合框时,它会打开并显示选项列表,并立即发送 LostFocus 和 MouseLeave 事件。因此,看起来控件失去了键盘焦点并且鼠标指针已移出其区域,而实际上 optins 的组合框列表是打开且处于活动状态的并且其中具有键盘焦点。

所以问题是我如何在我的程序中知道组合框中发生了什么?为了正确隐藏我的弹出菜单,我需要知道组合框中的选项列表何时打开或关闭。我看不到此文档或任何其他文档的任何事件。(想要的行为是:如果组合框关闭,我会根据鼠标光标的位置隐藏我的弹出菜单。如果组合框打开,我永远不会隐藏我的弹出菜单,直到用户在组合框中选择某些内容,或关闭组合框。 )

此外,如果您在第三方组合框替换方面有很好的经验,它的外观和工作方式相似并且引发了我需要的事件,请告诉我。

0 投票
1 回答
604 浏览

jquery - 如何在 mouseenter 上向左滑动 li 类,在 mouseleave 上向右滑动?

我正在尝试在 mouseenter 上向左滑动并在 mouseleave 上向右滑动到多个 li 类,这些类已经被具有悬停功能的图像交换脚本使用。

当我尝试在与上面相同的脚本中使用下面的脚本时$('#thumb ul li a').hover(,它会破坏现有的交换图像的悬停功能,并且 li 类不会滑动或执行任何操作。

我是否应该运行单独的脚本,一个用于交换图像,另一个用于滑动#thumb ul li a我定义为 li 类的链接?谢谢!

0 投票
1 回答
2292 浏览

.net - 在 VB.Net 中实现动态子菜单

在 .Net 3.5 中的 Windows 窗体上,我创建了一个菜单对象并使用 ToolStripMenuItems 填充它。其中一项附有 DropDown 对象。当鼠标悬停在父 ToolStripMenuItem 上时,DropDown 应该出现,并在鼠标离开 ToolStripMenuItem 时消失,除非它通过输入父级的 DropDown 来“离开”父级。

另外,我不希望 DropDown 在用户在其中进行选择时自动关闭,因此我将其“AutoClose”属性设置为 False。

让 DropDown 出现很容易。我刚刚为父 ToolStripMenuItem 上的“MouseEnter”事件设置了一个处理程序。但我一直试图让 DropDown 在正确的时间消失。如果我设置一个处理程序以在鼠标离开父 ToolStripMenuItem 时关闭它,则无法使用 DropDown,因为将鼠标移入 DropDown 意味着“离开”父 ToolStripMenuItem,因此 DropDown 会在用户试图将鼠标悬停在它上面!

我无法弄清楚如何检测鼠标是否真的离开了整个 ToolStripMenuItem / DropDown 程序集(在这种情况下 DropDown 应该关闭)或者通过输入 DropDown 只“离开” ToolStripMenuItem(在这种情况下DropDown 不应关闭)。

这似乎是一种常见的设计 - 当鼠标悬停/离开父元素时出现/消失的下拉菜单 - 那么它通常是如何完成的?感谢任何建议。

0 投票
0 回答
295 浏览

silverlight - Silverlight 4 and MouseLeave event inside an disabled UserControl

I have a little problem with my RIA-enabled SL application.

THE BACKGROUND:

The relevant part looks like this:

  • When any data operation (i.e. load, submit, login etc.) is in place, then a BusyOverlay control (which I wrote) disables RootVisual and provides a visual effect. When the operation is finished, then it sets RootVisual.IsEnabled to whatever it was before. It works just like ChildWindow when it comes to interaction with RootVisual (at least as far as I can tell).

  • One of the elements in RootVisual (which itself is a UserControl) is a hiding menu. It is a border which contains the actual menu. It has two storyboards in Resources (which increase and decrease it's width - nothing fancy, they are as simple as you can imagine), and the border itself has MouseEnter and MouseLeave handled. The handlers start one of the storyboards, just one line of code. I don't provide any samples because there is nothing interesting going on, it would just bloat the post. If you think it is necessary, just tell me and I'll post the relevant XAML and C# code.

THE PROBLEM:

When the RootVisual is disabled, then the Border.MouseLeave event does not fire. When user clicks something in the menu that loads initial data, and then moves the mouse outside the menu, it does not hide. Is there any way to elegantly solve this problem? CaptureMouse is out of question (it requires mouse left button to be down). All I can think of is to publish an "OperationFinished" event in my data operation handling static class and handle it in the UserControl which is RootVisual, but I think it's ugly and doesn't fit in my architecture. Is there something I'm missing?

I'll be grateful for any solutions and suggestions.

0 投票
3 回答
3220 浏览

jquery - jQuery - 帮助组合多个 mouseenter/mouseleave 事件

抱歉,如果这是一个菜鸟问题,但有没有办法结合这些 mouseenter/mouseleave 事件?

我已经尝试了各种程序员的各种方法。我试图通过将鼠标悬停在mouseenter函数链接到每个 div 的 li 类上来独立隐藏/显示多个 div,但我是 jQuery 新手,似乎找不到解决方案。我知道必须有一种更清洁的方法来做到这一点,但我还没有找到。任何帮助将不胜感激!

例子

谢谢

html:

0 投票
3 回答
1101 浏览

jquery - JQuery - 在 mouseenter 上显示一个 div

我创建了以下 HTML。黄色框包含图像缩略图。当我将鼠标悬停在缩略图上时,它会在缩略图顶部显示一个视图链接。

但是如果我快速移动鼠标,我会让链接 div 闪烁。

这是代码 - 您可以将其复制并粘贴为 html 并进行测试。

在 FF 4.0 中也没有调用 mouseleave。有任何想法吗?

0 投票
1 回答
957 浏览

jquery - mouseleave div,将背景颜色更改为灰色, mouseleave 触发 div 内的 Qtip,将背景颜色更改为粉红色

标题是不言自明的,这是我到目前为止所拥有的,但是在鼠标悬停时背景颜色总是保持灰色,而不是在 qtip 悬停时保持粉红色:

http://jsfiddle.net/bUzPG/21/完成设置。这真让我抓狂!
任何解决此问题的答案都将被标记为答案。

0 投票
1 回答
656 浏览

prototypejs - 鼠标进入鼠标离开滑动动画错误

我有一段代码用于显示当鼠标进入 div 时从 div 向上滑动的图片,该代码完全按照我想要的方式工作,除了当鼠标悬停进出太快并且动画没有时间时它会出错完成,我已经从 mouseover 和 mouseout 更改为 mouseenter 和 mouseleave ,这似乎没有帮助,任何建议都会很棒

0 投票
1 回答
2996 浏览

javascript - 拖动时jQuery mouseleave无法正确触发

我有一个带有行为不正确的 mouseleave 事件侦听器的可排序列表。

如果我将鼠标移入和移出可排序列表,mouseleave 会正确触发。

如果我首先单击并拖动其中一个可排序的子项,mouseleave 会错误地触发 - 偶尔或根本不会触发。

有任何想法吗?

谢谢。

更新:这也发生在 mouseout 事件中。

更新 我已经使用以下内容来检测孩子何时被完全拖到可排序之外:

0 投票
2 回答
529 浏览

jquery - jQuery MouseLeave 跨越一组类?

我有以下 HTML

在函数中使用哪个

我的问题是我只希望“mouseleave”功能在所有这些之外时触发?此刻它会从一个火到下一个.outer-field吗?

即如果它在外面,我希望它开火一次

我怎样才能做到这一点 ?