Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts

    JQuery UI accordion - no errors, and no accordion.

    I swear I got this working last week 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 - 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

    Code:
    <!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>

  • #2
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    Quote Originally Posted by Spudhead View Post
    I swear I got this working last week 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 - 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

    Code:
    <!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>
    Last edited by ryung_98; 09-12-2008 at 11:50 PM. Reason: Oops, wanted to preview first, not submit.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •