简体   繁体   English

触摸屏设备中的清除/重置悬停状态

[英]Clear/Reset hover state in touch screen devices

Any suggestions on how i can reset/clear a hover state that is activated within a touch screen device like an ipad. 关于如何重置/清除在ipad等触摸屏设备中激活的悬停状态的任何建议。

I have some tooltips that show on hover that's actually a click within the ipad due to how it deals with a hover. 我有一些提示显示在鼠标悬停时,实际上是ipad内的一次单击,这是因为它如何处理悬停。

But is there is a way to set it so the hover state gets reset to normal. 但是有一种方法可以对其进行设置,以便将悬停状态重置为正常状态。 As the problem is the tool tip won't re show as it still thinks it's being hovered. 因为问题在于工具提示不会显示,因为它仍然认为它一直在徘徊。 Clicking on another tooltip, then back on it works. 单击另一个工具提示,然后再恢复正常。

Edit: Very basic JSfiddle to demonstrate the issue, needs to be viewed within a ios device to see problem. 编辑:非常基本的JSfiddle来演示问题,需要在ios设备中查看才能看到问题。

hover(click when in ipdad) the box will appear and then disappear. 悬停(在ipdad中单击),该框将出现,然后消失。 Try hovering/clicking again and it won't re appear within a touch devices, unless you then hover/click on another tooltip and then back to that one. 尝试再次悬停/单击,它将不会再次出现在触摸设备中,除非您随后悬停/单击另一个工具提示,然后返回到该工具提示。

Depending on how the tool tip is implemented, it might be a good idea to just put a timeout on it. 根据工具提示的实现方式,仅对其设置超时可能是一个好主意。 Then after 10 seconds or so it just hides and resets itself. 然后大约10秒钟后,它会隐藏并自行重置。 If you add your code we could help with a specific recommendation. 如果您添加代码,我们可以为您提供具体建议。

EDIT: 编辑:

I added mousedown to your jquery events and it seems to work as you wish now on ipad. 我将mousedown添加到了您的jquery事件中,它现在可以按照您希望的方式在ipad上运行了。 See updated fiddle . 参见更新的小提琴

$('.tooltip').on('mouseenter mousedown', function(e){

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM