web-dev-qa-db-ja.com

jQuery UI:TypeError:$(...)。accordionは関数ではありません

何らかの理由でjQuery UI Accordionが機能しません。私はこのエラーを受け取り続けます:

TypeError:$(...)。accordionは関数ではありません

何が悪いのですか?同様のトピックに関するこのサイトの他の回答に基づいて、私はそれがインクルードされたファイルと関係があると思います。

私のヘッダーは次のとおりです。

<!-- Mobile Specific Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">  

<!-- CSS -->
<link rel="stylesheet" href="<?php echo base_url(); ?>css/base_con.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>css/skeleton.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>css/layout.css">

<!--[if lt IE 8]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE8.js"></script>
<![endif]-->

<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!-- Favicons -->
<link rel="shortcut icon" href="<?php echo base_url(); ?>images/favicon.ico">
<link rel="Apple-touch-icon" href="<?php echo base_url(); ?>images/Apple-touch-icon.png">
<link rel="Apple-touch-icon" sizes="72x72" href="images/Apple-touch-icon-72x72.png">
<link rel="Apple-touch-icon" sizes="114x114" href="images/Apple-touch-icon-114x114.png">
<link rel="stylesheet" href="<?php echo base_url(); ?>css/custom-theme/jquery-ui-1.10.0.custom.css" type="text/css" />

<!-- Scripts -->
<script src="<?php echo base_url(); ?>js/jquery-1.9.0.js"></script>
<script src="<?php echo base_url(); ?>js/jquery-ui-1.10.0.custom.js"></script>
<script src="<?php echo base_url(); ?>js/responsiveslides.min.js" type="text/javascript">
17
chuckfinley

この問題は、いくつかの異なる原因から発生する可能性があります。

  • JQuery UIライブラリを含めていません。
  • あなたはjQueryライブラリの包含の上にjQuery UIライブラリを包含しています
  • JQuery UIおよびjQueryライブラリへのパスが正しくない可能性があります
  • アコーディオンを持たないカスタムjQuery UIライブラリを使用しています

最初の2つは当てはまらないため、パスをトリプルチェックし、カスタムライブラリではなく完全なjQuery UIライブラリを使用することをお勧めします。

<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
32
martynas

2つのjquery.jsファイルを使用すると、競合が発生し、エラーがスローされる可能性があります。 2つ以上のjquery.jsファイルをインポートしないでください。

8
Vivek España

Jsファイルの順序は重要です!

/external/jquery/jquery.js should be listed above jquery-ui.js!
1
Chad Crowe

最後のコード行に、以下の順序でスクリプトを含めます。

上記のスクリプトによって処理されるため、以下を含める必要はありません。

1
AKS