自动完成导致 jQuery 悬停淡出(包含演示)
演示:http://www.christianbullock.com/so-demo/ (我知道有点生锈了)。
屏幕截图: http://i46.tinypic.com/2rh7fgn.png
将鼠标悬停在蓝色矩形上显示登录面板。它完全按照我想要的方式工作,除了如果您双击输入表单之一以显示之前输入的用户名,通过将鼠标悬停在建议的用户名之一上,面板会消失...... jQuery 认为我的鼠标已经离开了 div,而实际上它还没有离开。
以前有人遇到过这样的事情吗?有人知道修复方法吗?
谢谢。
Demo: http://www.christianbullock.com/so-demo/ (I know it's a bit rusty).
Screenshot: http://i46.tinypic.com/2rh7fgn.png
Hover over the blue rectangle to reveal the login panel. It works exactly how I'd like it to, with the exception that if you double-click one of the input forms to reveal the previously-entered usernames, by hovering over one of the suggested usernames the panel fades away...jQuery thinks my mouse has left the div when it actually hasn't.
Has anyone encountered anything like this before? Anyone know a fix?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,“自动完成”插件将添加一个
来保存完成字符串,而且我很确定它会将该 div 添加到
的末尾。内容。因此,当您将鼠标移入
时,您实际上是在将鼠标移出您自己的表单。
您可以让处理程序显式地将自动完成
视为您的处理程序的一部分,或者您可以“移动”
插件添加到你自己的。
编辑 - 如果您的问题源于本机浏览器“自动完成”下拉列表(如果可以的话,您可能希望禁用登录表单;尝试添加“自动完成” ”属性并将其设置为“false”),那么有一种可能性:在淡出表单容器的事件处理程序中,您可以检查当前的鼠标位置。如果鼠标位置仍在表单的边界框中,那么您可以忽略“鼠标悬停”。
Well the "autocomplete" plugin is going to add a
<div>
to hold the completion strings, and I'm pretty sure it adds that div to the end of the<body>
content. Thus, when you mouse into that<div>
you really are mousing out of your own form.You could maybe have your handler explicitly treat the autocomplete
<div>
as being part of yours, or else you might be able to "move" the<div>
the plugin adds into your own.edit — if your problem stems from the native browser "autocomplete" dropdown (which you may want to disable for a login form anyway, if you can; try adding an "autocomplete" attribute and set it to "false"), then here's a possibility: in the event handler that fades your form container, you can check the current mouse position. If the mouse position is still within the bounding box of your form, then you can ignore the "mouseout".