jQuery animate()实现背景色渐变效果的处理方法【使用jQuery.color.js插件】

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

jQuery animate()实现背景色渐变效果的处理方法【使用jQuery.color.js插件】

尼玛范爷   2020-05-15 我要评论

本文实例讲述了jQuery animate()实现背景色渐变效果的处理方法。分享给大家供大家参考,具体如下:

jquery animate函数不能处理背景色渐变,需要使用jquery.color插件

核心代码:

$(function(){
  $("#cdiv").animate(
    {
    backgroundColor:'#FF0000'
  },1000
   )
})

完整代码如下:

<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>背景色渐变效果</title>
</head>
<body>
  <script language="javascript" type="text/javascript" src="jquery-1.7.2.min.js"></script>
  <script type="text/javascript" src="js/jquery.color.js"></script>
  <div id='cdiv' style='width:200px;height:100px;background-color:white'></div>
  <script>
  $(function(){
    $("#cdiv").animate(
      {
        backgroundColor:'#FF0000'
      },1000
    )
  })
  </script>
</body>
</html>

运行效果图如下:

 

附:jQuery.color.js插件点击此处本站下载

PS:这里再为大家推荐几款相关的颜色与特效工具供大家参考使用:

在线特效文字/彩色文字生成工具:
http://tools.softyun.net/aideddesign/colortext

在线彩虹文字/颜色渐变文字生成工具:
http://tools.softyun.net/aideddesign/txt_caihongzi

在线发光字生成工具:
http://tools.softyun.net/aideddesign/txt_faguangzi

仿古书排版文字竖排转换工具:
http://tools.softyun.net/transcoding/shupai

希望本文所述对大家jQuery程序设计有所帮助。

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们