简体   繁体   English

jQuery手风琴-缺少什么?

[英]jQuery accordion - what's missing?

Here's my code; 这是我的代码;

 <head>
        <title>page title</title>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.js"></script>
    </head>

    <body>
  <script>
  $(function() {
    $( "#accordion" ).accordion();
  });
  </script>

    <div id="accordion">
      <h3>-shift title-</h3>
      <div><p>-shift content here-</p></div>
      <h3>-shift title-</h3>
      <div><p>-shift content here-</p></div>
    </div>

I'm sure i've missed something but my thinking is i've used a CDN and put the function in, the divs are not collapsing? 我确定我错过了一些东西,但是我的想法是我使用了CDN并将该函数放进去,div没有崩溃?

问题不包括<script src="https://code.jquery.com/ui/1.11.3/jquery-ui.js"></script>

I think you are using jQuery UI so you'll need to include that library below jQuery 我认为您使用的是jQuery UI,因此您需要将该库包含在jQuery下面

<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>

I'm not totally sure, but I think you may be missing some css files. 我不太确定,但我认为您可能会缺少一些CSS文件。

Use this as scripts, let's see if it's working: 将此用作脚本,让我们看看它是否有效:

<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM