jquery外掛程式anccordion

來源:互聯網
上載者:User

標籤:style   blog   http   io   color   ar   java   sp   div   

 1 (function(){ 2     $.fn.YAccordion=function(options){ 3      4         var settings={ 5             trigger:‘click‘, 6             speed:300, 7         }; 8          9         if(options)10             $.extend(settings,options);11         12         return this.each(function(){13             $("p",this).bind(settings.trigger,function(){14                 $(this).next("ul").slideToggle(settings.speed).siblings("ul").hide();15             });16             $("ul",this).hide().first().show();17         });18     }19 })();
 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 5 <meta http-equiv="Content-Language" content="zh-CN"/> 6 <script type="text/javascript"> 7 </script> 8 <style type="text/css"> 9 p{cursor:pointer;}10 </style>11 </head>12 <body>13 <div class="accordion">14     <p>第一欄</p>15     <ul>16         <li>aaaaaaaaa</li>17         <li>aaaaaaaaa</li>18         <li>aaaaaaaaa</li>19     </ul>20     <p>第二欄</p>21     <ul>22         <li>bbbbbbbbb</li>23         <li>bbbbbbbbb</li>24         <li>bbbbbbbbb</li>25     </ul>26     <p>第三欄</p>27     <ul>28         <li>ccccccccc</li>29         <li>ccccccccc</li>30         <li>ccccccccc</li>31     </ul>32 </div>33 <script src="../jquery-1.11.1.min.js" type="text/javascript"></script>34 <script src="jquery.yaccordion.js" type="text/javascript"></script>35 <script type="text/javascript">36     $(".accordion").YAccordion({speed:100});37 </script>38 </body>39 </html>

 

jquery外掛程式anccordion

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.