i have this little jquery code running on jquery 1.10.1, what i want to do is quite basically console log on hover events on hovering over li class dash_item, but it only works when i click the item, not on hover
我有这个小jquery代码在jquery 1.10.1上运行,我想要做的基本上是控制台登录悬停在li class dash_item上的悬停事件,但它只在我单击项目时有效,而不是在悬停时
CODE:
$(document).ready(function(){
$('.dash_item').on({
mouseenter: function(){
console.log("im here");
},
mouseleave: function(){
console.log("im out");
}
});
});
the jsfiddle is here http://jsfiddle.net/JQAw3/
jsfiddle在这里http://jsfiddle.net/JQAw3/
5 个解决方案
#1
34
Seems to be a Google Chrome bug that can happen when you have a website open for a long time, including the Dev Tools.
似乎是一个Google Chrome错误,当您长时间打开网站时可能会发生这种错误,包括Dev Tools。
I had the same problems, tried everything I could.
我遇到了同样的问题,尽我所能。
In the end, a simple browser restart helped.
最后,简单的浏览器重启有所帮助。
Maybe it's also enough if you simply open the website in another tab.
如果您只是在另一个标签页中打开网站,也许这也足够了。
Edit 2015-06-15: I encounter this problem every time I'm working on mouseenter
and mouseleave
in Chrome. For me, it's definitely enough to just close the tab and open the website in another.
编辑2015-06-15:每次我在Chrome中使用mouseenter和mouseleave时都会遇到这个问题。对我来说,只需关闭标签并在另一个网站上打开网站就足够了。
#2
0
You can try the jQuery hover() function. It takes a handlerIn and handlerOut.
您可以尝试jQuery hover()函数。它需要一个handlerIn和handlerOut。
#3
0
works fine with hover
悬停时工作正常
http://jsfiddle.net/blackjim/JQAw3/4/
$('.dash_item').hover(
function () {
console.log("im here");
},
function () {
console.log("im out");
}
);
#4
0
Leaving this here in case anyone else stumbles across this. In early 2015 this is still a 'feature' in chrome/chromium where if the page is being viewed as a file (NOT served from a webserver) the mouse position events like mouseenter
, mouseleave
, mouseover
, etc do not fire. Don't know if that was OP's issue but was mine when I stumbled across this.
离开这里以防万一其他人偶然发现这一点。在2015年初,这仍然是铬/铬的“特征”,如果页面被视为文件(不是从网络服务器提供),鼠标位置事件,如mouseenter,mouseleave,mouseover等都不会触发。不知道这是OP的问题,但是当我偶然发现这个问题时,我的问题就是我的问题。
#5
0
No it doesn't - same problems with hover as mouseenter
不,它没有 - 与鼠标中心悬停相同的问题
I have had developer tools open for some time
我有一段时间打开开发人员工具
Opened the page in firefox and it worked
在Firefox中打开页面,它工作正常
#1
34
Seems to be a Google Chrome bug that can happen when you have a website open for a long time, including the Dev Tools.
似乎是一个Google Chrome错误,当您长时间打开网站时可能会发生这种错误,包括Dev Tools。
I had the same problems, tried everything I could.
我遇到了同样的问题,尽我所能。
In the end, a simple browser restart helped.
最后,简单的浏览器重启有所帮助。
Maybe it's also enough if you simply open the website in another tab.
如果您只是在另一个标签页中打开网站,也许这也足够了。
Edit 2015-06-15: I encounter this problem every time I'm working on mouseenter
and mouseleave
in Chrome. For me, it's definitely enough to just close the tab and open the website in another.
编辑2015-06-15:每次我在Chrome中使用mouseenter和mouseleave时都会遇到这个问题。对我来说,只需关闭标签并在另一个网站上打开网站就足够了。
#2
0
You can try the jQuery hover() function. It takes a handlerIn and handlerOut.
您可以尝试jQuery hover()函数。它需要一个handlerIn和handlerOut。
#3
0
works fine with hover
悬停时工作正常
http://jsfiddle.net/blackjim/JQAw3/4/
$('.dash_item').hover(
function () {
console.log("im here");
},
function () {
console.log("im out");
}
);
#4
0
Leaving this here in case anyone else stumbles across this. In early 2015 this is still a 'feature' in chrome/chromium where if the page is being viewed as a file (NOT served from a webserver) the mouse position events like mouseenter
, mouseleave
, mouseover
, etc do not fire. Don't know if that was OP's issue but was mine when I stumbled across this.
离开这里以防万一其他人偶然发现这一点。在2015年初,这仍然是铬/铬的“特征”,如果页面被视为文件(不是从网络服务器提供),鼠标位置事件,如mouseenter,mouseleave,mouseover等都不会触发。不知道这是OP的问题,但是当我偶然发现这个问题时,我的问题就是我的问题。
#5
0
No it doesn't - same problems with hover as mouseenter
不,它没有 - 与鼠标中心悬停相同的问题
I have had developer tools open for some time
我有一段时间打开开发人员工具
Opened the page in firefox and it worked
在Firefox中打开页面,它工作正常