...

JQuery UI accordion - no errors, and no accordion.

Spudhead
09-01-2008, 12:48 PM
I swear I got this working last week :mad: I tried to add a slider to it, and it stopped working. So I took the slider back out, and it's still not working.

What I've got is below. I really can't see any significant ways it differs from the example (http://docs.jquery.com/UI/Accordion) - I'm pulling in the JQuery JS files from the Google code repository but they're loading fine and contain all the required bits as far as I can see.

The thing that's bugging me is that there are no errors. And it's behaving exactly the same in FF and IE. I must be missing something obvious, but I'm flumped if I can spot what it is :confused:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Studio</title>


<style type="text/css">

/* Accordion */

#accordion{
list-style-type:none;
margin:0;
padding:0;
}


</style>



<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.2/jquery-ui.js"></script>

<script type="text/javascript">

$(document).ready(function() {

$("#accordion").accordion();


});

</script>


</head>

<body>

<ul id="accordion">
<li>
<h2><a href='#'>Project Docs</a></h2>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam</p>
</div>
</li>
<li>
<h2><a href='#'>Information Architecture</a></h2>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam</p>
</div>
</li>
<li>
<h2><a href='#'>Design</a></h2>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</li>
</ul>


</body>
</html>

ryung_98
09-12-2008, 11:47 PM
Accordion looks for the next block after the link to accordionize. But since the anchor is inside the <h2></h2> element, there is no next block after the link. Try removing the <h2></h2>, it should work. Or tell Accordion to use the h2 instead of defaulting to the anchor.

I swear I got this working last week :mad: I tried to add a slider to it, and it stopped working. So I took the slider back out, and it's still not working.

What I've got is below. I really can't see any significant ways it differs from the example (http://docs.jquery.com/UI/Accordion) - I'm pulling in the JQuery JS files from the Google code repository but they're loading fine and contain all the required bits as far as I can see.

The thing that's bugging me is that there are no errors. And it's behaving exactly the same in FF and IE. I must be missing something obvious, but I'm flumped if I can spot what it is :confused:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Studio</title>


<style type="text/css">

/* Accordion */

#accordion{
list-style-type:none;
margin:0;
padding:0;
}


</style>



<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.2/jquery-ui.js"></script>

<script type="text/javascript">

$(document).ready(function() {

$("#accordion").accordion();


});

</script>


</head>

<body>

<ul id="accordion">
<li>
<h2><a href='#'>Project Docs</a></h2>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam</p>
</div>
</li>
<li>
<h2><a href='#'>Information Architecture</a></h2>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam</p>
</div>
</li>
<li>
<h2><a href='#'>Design</a></h2>
<div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</li>
</ul>


</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum