jQuery在悬停时设置动画边框颜色吗? [英] jQuery animate border color on hover?

查看:82
本文介绍了jQuery在悬停时设置动画边框颜色吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用颜色插件在悬停时设置背景颜色的动画.

Using a color plugin to animate background color on hover.

$(function() {
    $('.listing-2 li a').mouseover(function() {
        $(this).animate({
            backgroundColor: "#0e7796"
        }, 'fast');
    });
    $('.listing-2 li a').mouseout(function() {
        $(this).animate({
            backgroundColor: "#d6f2c5"
        }, 'fast');
    });
});

如何为边框颜色做同样的事情?

How can I do the same for border color?

推荐答案

在Google中找到

    $('.listing-2 li a').mouseover(function() {
    $(this).animate({ borderTopColor: "#0e7796" }, 'fast');
});
$('.listing-2 li a').mouseout(function() {
    $(this).animate({ borderTopColor: "#fff" }, 'fast');
});

它必须是"borderTopColor"(或左,右,下),而不是"borderColor".

it must be a "borderTopColor" (or left, right, bottom) instead of "borderColor".

这篇关于jQuery在悬停时设置动画边框颜色吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆