jQuery and mouseover issue
I have the following code:
$('a.home-page-link').mouseover(function() {
开发者_运维问答 $(this).animate({
opacity: 0.4
}, 200, function());
});
For some reason, this refuses to "play ball", any ideas?
Cheers!
Try adding {} to the second function
$('a.home-page-link').mouseover(function() {
$(this).animate({
opacity: 0.4
}, 200, function() { } );
});
$('a.home-page-link').mouseover(function() {
$(this).animate({
opacity: 0.4
}, 200, function(){});
});
make sure your callback function is declared correctly. then it should work. test it here: http://jsfiddle.net/5XwKG/
Not sure if you just forgot to paste something but the third argument to .animate()
- function()
will throw an error as there is no function body defined: function() {}
or just leave that last argument off might help.
If you don't need the callback function, leave it out:
$('a.home-page-link').mouseover(function() {
$(this).animate({
opacity: 0.4
}, 200);
});
Tried this? It works for me...
$(document).ready(function()
{
$('a.home-page-link').mouseover(function()
{
$(this).animate({opacity:0.4}, 200);
});
});
精彩评论