嗨,我正在使用这个页面上的悬停动画:http://bit.ly/xtvgSq
使用CSS3转换,你可以看到它在Chrome和火狐浏览器上都能正常工作。
在IE上,我使用这段代码来使用Jquery不透明淡入淡出来复制效果。然而,当我将鼠标悬停在每个面板的标题上时,淡入淡出的效果就消失了。我希望它能保持淡出效果,就像它在Chrome和Firefox中工作一样,即使我停留在项目的标题上。我该怎么做呢?
下面是我使用的jQuery代码:
if( jQuery('body').hasClass('ie8') || jQuery('body').hasClass('ie7') || jQuery('body').hasClass('ie9')) {
var projectImages = jQuery('.project-panel-overlay').siblings('img');
projectImages.hover(
function() {
jQuery(this).animate({
opacity: .4
}, 300);
},
function() {
jQuery(this).animate({
opacity: 1
}, 300);
}
);}
发布于 2012-01-25 09:35:07
试试这个(示例:http://jsfiddle.net/FNNtT/5/):
jQuery('.hitbox').live('mouseenter',function(){
jQuery(this).children('img').animate({
opacity: .4
}, 300);
});
jQuery('.hitbox').live('mouseleave',function(){
jQuery(this).children('img').animate({
opacity: 1
}, 300);
});你也需要稍微修改一下你的html:
<div class="project-panel">
<a class="hitbox" href=http://jpgalea.com/eco/projects/kangaroo-ground/>
<div class="project-panel-overlay">
<div class="project-panel-intro">
<p class="name">Kangaroo Ground</p>
<p class="year">2011/2012</p>
</div>
</div>
<img width="235" height="446" src="http://jpgalea.com/eco/wp-content/uploads/2012/01/featured41.jpg" class="attachment-featured-image-project wp-post-image" alt="" title="" /> </a>
</div>请注意,锚有一个名为"hitbox“的类。
这将针对整个部分,而不是img。在最初发布的代码中,选择器只针对图像,这是锚点下的一个子元素,不包括文本。
https://stackoverflow.com/questions/8996696
复制相似问题