jquery---5

来源:互联网 发布:单片机 脉冲信号 编辑:程序博客网 时间:2024/05/23 13:15

》sone main mouse events :click   mouseenter   mouseleave    dblclick(双击)

.trigger()??   Execute all handlers and behaviors attached to the matched elements for the given event ty

关于点击隐藏的小程序,点击heading,隐藏或者显现本段段落。

<!DOCTYPE html><html>  <head>    <title>Chapter 05, Accordion</title>    <script src="jquery.js"></script>    <script src="app.js"></script>    <link rel="stylesheet" href="style.css" />  </head>  <body>  <div id="accordion"><h2>Heading</h2><p>the first paragraph.</p><h2>Heading 2</h2><p>second paragraph.</p><h2>Heading 3</h2><p>the third paragraph.</p></div>  </body></html>
</pre><p></p><h2><span style="font-family:Helvetica Neue,HelveticaNeue,Helvetica,Arial,sans-serif;"><span style="line-height:22.5px">app.js:</span></span><pre name="code" class="html"><span style="font-family:Helvetica Neue, HelveticaNeue, Helvetica, Arial, sans-serif;"><span style="font-weight: normal; line-height: 22.5px;">$(function() {var  head = $("h2");var  para = $("p");head.on("click",function(){$(this).next().slideToggle();//</span></span><span style="font-weight: normal;"><span style="font-size:10px;color:#cc0000;">slideToggle():显示与隐藏的切换。next()是指head下一个节点p</span></span><span style="font-family:Helvetica Neue, HelveticaNeue, Helvetica, Arial, sans-serif;"><span style="font-weight: normal; line-height: 22.5px;">});});</span></span>

0 0
原创粉丝点击