简体   繁体   English

Chrome:点击后没有悬停状态,随机发生

[英]Chrome: no hover state after clicking, happens randomly

Can't believe I didn't find anything about it on google, such an annoying bug, not sure if it even can be fixed without google updating their browser.不敢相信我在谷歌上没有找到任何关于它的东西,这样一个烦人的错误,不确定它是否可以在没有谷歌更新浏览器的情况下修复。

Problem description: After clicking on an element which has hover state attached to it, at randomly, the hover state doesn't appear until you re-click or move the mouse.问题描述:点击一个附加了悬停状态的元素后,随机出现悬停状态,直到您重新单击或移动鼠标。

And it gets worse if you try it on a custom checkbox, I guess it's somehow related to the fact that it creates a double click.如果您在自定义复选框上尝试它会变得更糟,我想这与它创建双击的事实有某种关系。 But still the bug appears even with a plain div that has hover attached to it.但是,即使带有悬停附加到它的普通 div仍然会出现该错误。

All works fine in Firefox and IE.在 Firefox 和 IE 中一切正常。

Video capture with chrome info:带 chrome 信息的视频捕获:

在此处输入图片说明

Test yourself:测试自己:

 i = 0; $( ".button" ).click(function() { i++; $(".clicks").html(i); });
 body { text-align: center; } .button { background: #252B33; width: 100px; height: 100px; text-align: center; margin-bottom: 30px; display: flex; border-radius: 5px; align-items: center; justify-content: center; margin-left: auto; margin-right: auto; } .button:hover { background: #ccc; cursor: pointer; } input { display: none; } .custom_checkbox { width: 30px; height: 30px; background: #5E6569; border-radius: 50%; } input:checked ~ .custom_checkbox { background: #FF4F68; }
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <br> Number of clicks: <span class="clicks"> 0 </span> <br><br> <div class="button"> </div> <label class="button"> <input type="checkbox"> <div class="custom_checkbox"> </div> </label>

After doing "end task" on google chrome, the problem seems to have disappeared.在谷歌浏览器上执行“结束任务”后,问题似乎消失了。 I did try to close and start the browser before, but only doing the end-task helped.我之前确实尝试过关闭并启动浏览器,但只有完成最终任务才有帮助。

It must be related to trash collector as I had the browser running and in use daily for a week or so (at nights putting computer to sleep (Windows 8.1)).它必须与垃圾收集器有关,因为我每天都在运行浏览器并使用一个星期左右(晚上让计算机进入睡眠状态(Windows 8.1))。

Will let you know if it should reappear.会让你知道它是否应该重新出现。

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

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