javascript - jquery animate 改变border颜色不生效

查看:158
本文介绍了javascript - jquery animate 改变border颜色不生效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

$(".dh_cont").eq(2).animate({
    "height":"170px",
    "border-color":"red"
},1000);

animate不能改变border的颜色吗?为嘛高度可以改变,border颜色不能改变呢??

解决方案

  • jQuery.UI 中支持颜色的动画 https://jqueryui.com/animate/

    $( "#effect" ).animate({
              backgroundColor: "#aa0000",
              color: "#fff",
              width: 500
            }, 1000 );

    
    缺点:只是为了实现这一个功能,却要附带的载入jquery.ui那么大一个库
    

  • Animating colors https://bitstorm.org/jquery/color-animation/

    $('#demodiv').animate({borderBottomColor: '#00346B'})

这篇关于javascript - jquery animate 改变border颜色不生效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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