views:

36

answers:

2

So i'm trying to make tabs with the JQuery UI framework, but I can't get them to work. It just shows up as a bulleted list, and then with the divs all under each other. I read on another post that you needed some sort of css/theming which i didn't have before, so i downloaded one with a custom theme. i unzipped it in my media folder and it made the js, css, and development-bundle folder.

I have the two js scripts included in the page, and i checked in the chrome developer tool to make sure they were loading and they are. I also ahve the following code in my file:

<head>
<script type='text/javascript'>
$(document).ready(function(){
    $("#tabs").tabs();
});
</script>
</head>
<div id='tabs'>
    <ul>
        <li><a href='#tabs-1'>Manage Categories</a></li>
        <li><a href='#tabs-2'>Add Forms</a></li>
        <li><a href='#tabs-3'>Change Forms</a></li>
    </ul>
    <div id='tabs-1'>
        <h4>Current Categories</h4>
        {% for category in categories %}
            <a href='/admin/fm/delcat/{{ category }}/'>Delete</a> &nbsp;&nbsp;&nbsp; {{ category }}<br />
        {% endfor %}
    </div>
    <div id='tabs-2'>
        <p> stuff</p>
    </div>
    <div id='tabs-3'>
        <p>stuff</p>
    </div>
</div>

Not sure why it doesnt work.

+2  A: 

You need to include the JQuery UI CSS file.

<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />

That should do it.

Cody Brocious
A: 

In order to reproduce what you described, I had to omit the stylesheet. That would suggest you haven't quite got the CSS part.

The tabs example code on the jquery site is a good start, which is where I copied the following from and then pasted on top of your code

  <link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
  <script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.3.2.js"&gt;&lt;/script&gt;
  <script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"&gt;&lt;/script&gt;
  <script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.tabs.js"&gt;&lt;/script&gt;
Ryan Graham