chell
chell

Reputation: 7866

Why isn't this js accordion working

I'm trying to get Jquery accordion working but I can't seem to.

Here is the code
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>accordion demo</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
</head>
<body>
    <div id="accordion">
         <h3>Read More</h3>

        <div>
            <p>Whether you choose to create a healthier lifestyle, deeper relationships, or seek more fulfillment in your career, TeamUp will take you there.</p>
            <p>You’ll discover your <b>patterns of behavior</b> and consciously choose which ones to keep and which ones to change. You'll experience your life from a new and refreshing perspective.</p>
        </div>
    </div>

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

Here is what I'm doing on JSFiddle

http://jsfiddle.net/CQu35/

Any help appreciated

Thanks

Upvotes: 0

Views: 321

Answers (3)

Tims
Tims

Reputation: 2007

It works fine if you:

  • Use jQuery 2.02
  • Use JQuery UI 1.10.3
  • Set collapsible: true in the accordion params (by default, accordions always keep one section open)

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

Upvotes: 0

SajithNair
SajithNair

Reputation: 3867

Looks like the problem is with your fiddle only. I pasted your entire code in jsfiddle and it looks to be working.

Same code pasted in your question

http://jsfiddle.net/sajith/VQ6z2/

Upvotes: 0

Arun P Johny
Arun P Johny

Reputation: 388436

The only problem I could see is the use relative protocol, it wouldn't work if the file is loaded from local file system

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

Your jsfiddle has problem because it looks like jsfiddle is not including the jQuery-ui.js file

Upvotes: 1

Related Questions