在下面的图中,你可以看到当我悬停图像时,黑盒会弹跳。
我只希望能够悬停在黑盒上。我不明白我错过了什么。
另外,我想在黑匣子上添加一些CSS3,当它在顶部悬停时。为此,我添加了一个类.focus,但似乎不起作用。有什么建议吗?答:
http://jsfiddle.net/Q6Czh/19/
发布于 2012-02-25 00:26:52
您将在<li>元素上绑定悬停事件,而不仅仅是在<a> (黑盒)上,因此当您悬停列表元素中的任何元素时都会触发该事件。
将您的代码更改为:
// bind hover on the anchor element
$("#nav-shadow li a").hover(function() {
var e = this;
// remove the .find('a') as 'e' is the anchor
$(e).stop().animate({
...
}, 250, function() {
...
});
// use .sibling() instead of .find('img')
$(e).siblings("img.width320").stop().animate({
...
}, 250);
}, function() {
...
});对于第二部分,我不知道你想解释什么。:-/
https://stackoverflow.com/questions/9434181
复制相似问题