fadeIn and Out effect on hover with jQuery
I'm currently using a hover effect using jQueryUI like this:
$('#menu-header-menu li a').hover(
function() {
$(this).animate({ backgroundColor: '#eaeaea'}, 500);
},
function() {
$(this).animate({ backgroundColor: '#fff'}, 500);
}
);
But I feel that including 开发者_C百科both jQuery and jQueryUI libraries to accomplish this isn't necessary. Is there any smart way to do this using fadeIn
and fadeOut
with only jQuery?
I've tried some various things but can't make it work without jQueryUI.
Thanks / Tobias
In order to perform animations with colors, you will need to use the jQuery Color Animations Plugin or a bare-bones fx
package from jQuery UI
.
Alternatively, you can animate to a class with this plugin: http://plugins.jquery.com/project/animate-to-class
精彩评论