繁体   English   中英

jQuery手风琴-缺少什么?

[英]jQuery accordion - what's missing?

这是我的代码;

 <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>

我确定我错过了一些东西,但是我的想法是我使用了CDN并将该函数放进去,div没有崩溃?

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

我认为您使用的是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>

我不太确定,但我认为您可能会缺少一些CSS文件。

将此用作脚本,让我们看看它是否有效:

<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