我一直试图在我正在处理的网站上的所有图像上放置一个链接,但我遇到了 jQuery.mouseenter 问题,然后用户将鼠标悬停在链接上。
这是我的例子:https://jsfiddle.net/13yxxww5/
我的代码:
jQuery('img').mouseenter(function(){
jQuery('#hover').stop(true, false).fadeIn();
}).mouseleave(function(){
jQuery('#hover').stop(true, false).fadeOut();
});
任何帮助都会很棒。
最佳答案
只需要添加一件事,包括链接元素,例如图像的过去,请参见下面的代码:
jQuery('img, #link1').mouseenter(function(){
jQuery('#hover').stop(true, false).fadeIn();
}).mouseleave(function(){
jQuery('#hover').stop(true, false).fadeOut();
});
关于javascript - 悬停共享链接的麻烦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30973249/