On Hover我正在尝试添加一个类并更改图像,但我的图像仍然悬停在静止状态。 fiddle
$( "img.animation" ).hover(
function() {
$( this )
.attr('src', "https://raw.githubusercontent.com/thoughtbot/refills/master/source/images/placeholder_logo_2.png")
.addClass("animated fadeInDown");
}, function() {
$( this )
.attr('src', "https://raw.githubusercontent.com/thoughtbot/refills/master/source/images/placeholder_logo_1.png")
.removeClass("animated fadeInDown").animate("slow");
}
);
答案 0 :(得分:2)
答案 1 :(得分:1)
您没有img.animation
这样看起来很棒:
$(document).ready(function(){
//http://api.jquery.com/hover/
//changing logo
$( ".grid-item" ).hover(
function() {
$( this )
.find('img')
.attr('src', "https://raw.githubusercontent.com/thoughtbot/refills/master/source/images/placeholder_logo_2.png")
.addClass("animated fadeInDown");
}, function() {
//than slide it up
$( this )
.find('img')
.attr('src', "https://raw.githubusercontent.com/thoughtbot/refills/master/source/images/placeholder_logo_1.png")
.removeClass("animated fadeInDown")
.animate("slow");
}
);
});//docu.ready