jquery.color.js的使用

Jquery本身不支持变色,Jquery Color.js弥补了这缺陷并为animate动画赋予变色效果,如下红变蓝后执行回调再由蓝变红。

复制代码
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style>
        #box {
            width:100px;
            height:100px;
            background-color:red;
            cursor:pointer;
        }
    </style>
</head>
<body>
    <div class="box" id="box"></div>
    <script type="text/javascript" src="/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="/js/jquery.color.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#box").mouseenter(function () {
                $(this).stop(true, true).animate({ "backgroundColor": 'blue' }, 5400, function () {
                    $(this).animate({ "backgroundColor": 'red' }, 5400);
                });
            });
        });
    </script>
</body>
</html>
复制代码

 

支持的其他属性如下

backgroundColor, borderBottomColor, borderLeftColor, borderRightColor, borderTopColor, color, columnRuleColor, outlineColor, textDecorationColor, textEmphasisColor

posted @   Fast Mover  阅读(3298)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
友情链接: A4纸尺寸 | 卡通头像 | +申请友情链接
点击右上角即可分享
微信分享提示