简体   繁体   中英

jQuery accordion not working on site

I wanted to try and use an accordion feature on my website, I copied and pasted the source code on the website http://jqueryui.com/ nothing happens. My browser just produces text without the accordion feature. Please help, am using Microsoft expression to edit my code.

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>jQuery UI Accordion - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script>
  $(function() {
    $( "#accordion" ).accordion();
  });
  </script>
</head>
<body>

<div id="accordion">
  <h3>Section 1</h3>
  <div>
    <p>
    Holla holla
    </p>
  </div>
  <h3>Section 2</h3>
  <div>
    <p>
    Namaste
    </p>
  </div>
  <h3>Section 3</h3>
  <div>
    <p>
   adaab
    </p>

  </div>
</div>


</body>
</html>

Annie you didn't provided you complete code and what was the errors you were getting. Now use and experiment this code to fulfill your configurations

your problem is with path you given for the resources

give complete path of links (starting with http) you provided for js and css files

if it doesn't work. go for below steps

Download those files(hit link in browser--> right click--> save as -->)

Put every downloaded js and css inside the same folder where your HTML/JSP file present and just give the file names without any path in the src and href attributes for js and CSS files respectively

This will work for sure

Without seeing your markup, and reading exactly what you wrote - you copied and pasted the code...

Did that include both stylesheet and script links?

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

If you did that - then I would use Firebug ( https://getfirebug.com/ ) to debug the page you are developing and see if there are any problems with your links.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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