开发者

fadeIn and Out effect on hover with jQuery

开发者 https://www.devze.com 2023-01-30 16:31 出处:网络
I\'m currently using a hover effect using jQueryUI like this: $(\'#menu-header-menu li a\').hover( function() {

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

0

精彩评论

暂无评论...
验证码 换一张
取 消