簡體   English   中英

無法識別jQuery UI手風琴()函數

[英]Doesn't recognize jQuery UI accordion() function

我正在用jQuery-UI進行測試,並想使用手風琴。 我做了這個測試手風琴:

<div id="accordion">
      <h3>Section 1</h3>
      <div>
          <p>text text text text text text text text text </p>
      </div>
      <h3>Section 2</h3>
      <div>
          <p>text text text text text text text text text </p>
      </div>
      <h3>Section 3</h3>
      <div>
          <p>text text text text text text text text text </p>
      </div>
      <h3>Section 4</h3>
      <div>
          <p>text text text text text text text text text </p>
      </div>
  </div>

功能:

$(function(){
    $('#accordion').accordion({
        collapsible: true
    });
});

但是每次運行它都會收到此錯誤:

> Uncaught TypeError: $(...).accordion is not a function
    at HTMLDocument.<anonymous> (index.js:173)
    at j (jquery.min.js:2)
    at k (jquery.min.js:2)

我從jQuery網站下載了所有需要的文件並鏈接了所有內容,但我一直收到此錯誤。 我不知道這是什么問題。

使用jQuery CDN:

  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

和使用

$( function() {
        $( "#accordion" ).accordion({
             collapsible: "true" //commas
        });
    } );

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM