tabs are not being displayed

tetramentis - October 5, 2008 - 22:06
Project:Tabs-Auto
Version:5.x-2.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi, thanks for the module!

I think I have some JS-level problem with tabsauto...

On my Drupal installation, Tabsauto seems to be working, but there is a single (major) issue: instead of being displayed as tabs, items (e.g. I have headings "First" and "Second") are just displayed as UL items, with hrefs to anchors within the text. Full node text is visible, and clicking "first" or "second" only jumps within the page to the beginning of the appropriate text chunk.

After examining page source, I do see the following files being included:

<style type="text/css" media="all">@import "/sites/all/modules/tabsauto/tabsauto.css";</style>
<script type="text/javascript" src="/misc/jquery.js"></script>
<script type="text/javascript" src="/sites/all/modules/jquery_update/compat.js"></script>
<script type="text/javascript" src="/sites/all/modules/jquery_ui/jquery.ui/ui/minified/ui.core.min.js"></script>
<script type="text/javascript" src="/sites/all/modules/jquery_ui/jquery.ui/ui/minified/ui.tabs.min.js"></script>

This code structure is correctly generated for the node content:

<div class="flora" id="tabsauto">
<ul><li><a href="#first">first</a></li><li><a href="#Second">Second</a></li></ul>
<div id="first"><p>Some content.</p> </div>
<div id="Second"><p>More content.</p> </div>
</div>

Firebug displays a single JS error: "$ is not defined", pointing at the tabsauto-script line:

$(document).ready(function(){ $("#tabsauto > ul").tabs(); });

I am not quite good with JS, so I'll appreciate any pointers/help to resolve the issue I have.

I'll keep digging (as I need this functionality urgently), and will post updates if anything comes out of my efforts.

#1

realnerd - October 23, 2008 - 01:14

same problem here, using IE7 exact same javascript error. will look into it but don't have a lot of time to do so. if anyone else can help, please do. this module is exactly what i need for one of my projects.

#2

rimu - March 24, 2009 - 04:10

This is happening because the module injects some javascript into the head section of the page, before jquery is loaded. It uses drupal_set_html_head to do this. I dont' know how to make it add it's javascript later in the head section. Anyone?

#3

rimu - March 24, 2009 - 04:16

Ah I just reversed these two bits in my page.tpl.php

<?php
print $head;
?>

<?php
print $scripts;
?>

It eliminated the Javascript error, but didn't change how my tabs (don't) look...

 
 

Drupal is a registered trademark of Dries Buytaert.