I have an HTML document. It looks like this:
When the user hovers "stackinfo" image, I want it look like this:
My code for image:
<img src="/Resources/Images/MainMenu/logo.png" name="Logo" width="100" height="30" class="MainMenu" id="Logo" />
I know how to change the src
of the image on hover, but how can I animate this?
(I want to do it with jQuery)
What I have already tried:
$(document).ready(function(){
$('img[name="Logo"]').hover(function(event){
$(this).fadeIn(function(event){
$(this).attr("src","/Resources/Images/MainMenu/logoHover.png");
});
},
function(event){
$(this).fadeToggle(function(event){
$(this).attr("src","/Resources/Images/MainMenu/logo.png");
});
});
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…