开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜