jQuery中的.addClass()用法

来源:互联网 发布:mac mobi 制作软件 编辑:程序博客网 时间:2024/06/04 20:02

用法

描述:当动画样式改变时,为匹配的元素集合内的每个元素添加指定的 Class。

代码:

<!doctype html><html lang="en"><head>  <meta charset="utf-8">  <title>.addClass() 演示</title>  <link rel="stylesheet" href="//apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">  <style>  div {    width: 100px;    height: 100px;    background-color: #ccc;  }  .big-blue {    width: 200px;    height: 200px;    background-color: #00f;  }  </style>  <script src="//apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>  <script src="//apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script></head><body> <div></div> <script>$( "div" ).click(function() {  $( this ).addClass( "big-blue", 1000, "easeOutBounce" );});</script> </body></html>


原创粉丝点击