Accordion not working
Manuel Garcia - January 25, 2009 - 18:22
| Project: | jQuery UI |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | support request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | duplicate |
Jump to:
Description
I've tested this with the exact same markup on a standalone html file, and the accordion works, but if i try it on drupal it doesn't. Trying to do it on a teaser view, with thoughts of perhaps turning it into a views plugin.
Here's how I'm using it:
<?php
jquery_ui_add('ui.accordion');
?><script type="text/javascript">
$(function(){
$('div.view-content').accordion({
header: "div.view-content div.views-field-title",
fillSpace: true,
});
$('div.views-field-title a').click(function(){
return false;
});
});
</script>
<style type="text/css">
div.view-content {
margin: 0 auto;
width: 500px;
height: 520px;
}
div.views-field-teaser p {
margin: 0 5px;
}
div.views-field-title {
display: block;
border: 1px solid #888;
padding: 4px;
}
</style>I attach the standalone files so you can duplicate this if you want. The only difference is that I'm using a personalized download with all the compontents selected, as min, and grabing the jquery file from the google code page (see the html source).
Here is the error im seeing on firebug (only when i click on the div that triggers the accordion):
c.Event is not a function
ui.core.min.js?W (line 10)
(function(c){var i=c.fn.remove,d=c.brows...ncel:null,distance:1,delay:0}})(jQuery);I've been going nuts here this evening hopefully someone can point at what im doing wrong here :s
| Attachment | Size |
|---|---|
| accordion.zip | 49.32 KB |

#1
Note that the views style is set to Unformatted, the markup provided should work, and is what im using on the standalone html file.
#2
Can you post a link to an example using the jquery_ui module?
#3
Sorry mfer, doing this local... actually, I ended up writing my own jquery for this, and I'm happy to say I've got a working version of the views style plugin module. This way it doesn't depend on JQuery UI, and is lighter on the site. I still have to smooth it out and add some documentation.
So I think we can close this support request, who knows what's going on on my over-abused d6 install here.
BTW, if anyone want to help me testing this views_accordion module, I'm online on IRC (manuee), drop me a notice if you got five minutes!
#4
Got the same error for the ui.tabs... and my installation is pure. Please point me what can be wrong?
#5
Found an error. Jquery lib in jquery_update module is not the right version (i don't know why). Fixed by copying from jquery_ui/jquery.ui/jquery-1.3.1.js to jquery_update/replace/jquery.js.
I hope it helps.
#6
@cyberpunk be warned that there are issues in jquery 1.3.1 and in drupal with an update to jquery 1.3.1. Stuff will break.
#7
Yeah, found them... looks like updating to 1.3.1 in Drupal 6 is not the right thing to do.
#8
This error of "Event is not a function" will be generated if you use version 1.7 of jQuery UI because that requires jQuery 1.3+. If you use the "Legacy (1.5.3: for jQuery 1.2.6)" version of jQuery UI then you should be OK, because, as of this writing at least, jquery_update uses jQuery 1.2.6.
#9
I'm using jquery update 6.x 1.1 and jquery UI 6.x-1.2 (using the Legacy version)
I get a firebug error as if accordian was not found:
$("#accordion").accordion is not a function$("#accordion").accordion();
Here the headers of the loaded page (the jqery and js calls are from the template.php file):
<script type="text/javascript" src="/drupal/sites/all/modules/jquery_update/replace/jquery.js?r"></script>
<script type="text/javascript" src="/drupal/misc/drupal.js?r"></script>
<script type="text/javascript" src="/drupal/sites/all/modules/jquerymenu/jquerymenu_no_animation.js?r"></script>
<script type="text/javascript" src="/drupal/sites/all/modules/jquery_ui/jquery.ui/ui/ui.core.js?r"></script>
<script type="text/javascript" src="/drupal/sites/all/modules/jquery_ui/jquery.ui/ui/ui.accordian.js?r"></script>
<script type="text/javascript" src="/drupal/sites/all/themes/garland/initaccord.js?r"></script>
And here is the contents of the initaccord.js:
$(document).ready(function() {
$("#accordion").accordion();
});
I initially thought jquery menu might be messing things up but even after deactivation, still didn't work.
Any ideas?
Thanks!
#10
I've got the same error with the draggable() function. Using jquery_UI module 6.x-1.2, and jquery 1.5.3.
Furthermore, I see in my apache logs that a "file not found" error is generated when I step through the draggable() line in my code:
[Sun Mar 22 21:54:36 2009] [error] [client xxx.xxx.xxx.xxx] File does not exist: /var/www/working/sites, referer: http:// ....What jumps out to me right away is that my drupal site is hosted at /var/www/working/sitename, not /var/www/working/. I'm guessing that at some point, the module is referencing the webserver root while looking for the sites directory, when it should be referencing the webSITE root.
Are the other reports coming from sites where the website is hosted off a subdirectory on the server, by any chance?
- J
#11
@omills: Are the referenced JS files in those locations? That's the first debugging step. Copy and paste the URL into the browser to confirm. You are referencing "ui.accordian.js" but it should be "ui.accordion.js" with an O not an A.
@jthorson: I develop on a machine where all sites are in a subdirectory and jQuery UI works for me there. Can you post more details?
#12
You need to use the proper version of jQuery UI.
Marking as duplicate of #362509: New jQuery UI release system. Please search for existing issues before submitting a new one. You can follow up on that issue to track its status instead. If any information from this issue is missing in the other issue, please make sure you provide it over there.
However, thanks for taking the time to report this issue.