MyBB Community Forums

Full Version: Forum Collapse not compatible with jQuery?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I'm trying to create a dropdown jQuery menu. However, whenever I add the JavaScript, the forum collapse images stop working.

This is the code I am trying to install: http://labs.makotokw.com/s/jquery/menu

I'm installed other ones as well, none of them work with the collapsers. Any ideas why?

PS: Does anybody have a working jQuery dropdown that IS compatible?
May I see what you have in the <head></head> most of times when you have multiply javascripts in the head some might not work because they are not included in the right order in the <head>.
Add this inbetween <head> </head>, so now you can use jquery with any other Librarie.

EDIT: just make sure you give the correct link to the js file too.

<script src=\\\"jquery.js\\\"></script>
   <script>
     jQuery.noConflict();
     
     // Use jQuery via jQuery(...)
     jQuery(document).ready(function(){
       jQuery(\\\"div\\\").hide();
     });
     
     // Use Prototype with $(...), etc.
     $(\\\'someid\\\').hide();
   </script>
(2009-11-03, 03:46 AM)fghthth56y Wrote: [ -> ]Add this inbetween <head> </head>, so now you can use jquery with any other Librarie.

EDIT: just make sure you give the correct link to the js file too.

<script src=\\\"jquery.js\\\"></script>
   <script>
     jQuery.noConflict();
     
     // Use jQuery via jQuery(...)
     jQuery(document).ready(function(){
       jQuery(\\\"div\\\").hide();
     });
     
     // Use Prototype with $(...), etc.
     $(\\\'someid\\\').hide();
   </script>
I assume I have to edit 'someid'? To what?
Leave your other js script file inplace and just add the code i posted before it.
I never got this to work either, Zash. I didn't have enough time to figure out why so I just made a workaround. Edit the tbody of the forumbit_depth1_cat, and add name="cat_{$forum['fid']}".

Then, in your jQuery, you just need to code jQuery("tbody[name='cat_3']").hide();, and category 3 will be collapsed. I eventually made an expand function and assigned it onclick of the category header and expcolimage.
(2009-11-03, 08:40 AM)Tomm M Wrote: [ -> ]I never got this to work either, Zash. I didn't have enough time to figure out why so I just made a workaround. Edit the tbody of the forumbit_depth1_cat, and add name="cat_{$forum['fid']}".

Then, in your jQuery, you just need to code jQuery("tbody[name='cat_3']").hide();, and category 3 will be collapsed. I eventually made an expand function and assigned it onclick of the category header and expcolimage.
Hi, I think you got confused Smile

I want to use the default collapse image - it's just that when I use jQuery on any other part of the forum (IE a dropdown), the collapse starts working.

The conflicting code is : http://ajax.googleapis.com/ajax/libs/jqu...ery.min.js


Here's an example:

http://indiepaper.com/ uses the jQuery toggle panel and slider, so now the categories don't drop down.

@fghthth56y, it didn't do anything
Hmm, I didn't get it confused really... I meant you might need to change the way the categories collapse to jQuery code. I posted a way to do it easily.
(2009-11-03, 12:33 PM)Tomm M Wrote: [ -> ]Hmm, I didn't get it confused really... I meant you might need to change the way the categories collapse to jQuery code. I posted a way to do it easily.

Is there any way I can get that code? I'm pretty hopeless with JavaScript, and I really do want to use the drop down menu.
Hmm, mine works the opposite way to what you want (as in, I want my categories collapsed at page load, as apposed to being open). I've made loads of changes to the website I'm using this on, and I can't remember whether it's the JS that needs changed, or whether the code in MyBB needs changed... Undecided

Here's the code, let me know how things go. In forumbit_depth1_cat, you'll need to remove the class="expander" from the collapsed image div (this will stop MyBB trying to close it).

Edit: You need to add an onclick event too that.

<div class="expcolimage"><img src="{$theme['imgdir']}/{$expcolimage}" id="cat_{$forum['fid']}_img" onclick="expand({$forum['fid']});" alt="{$expaltext}" title="{$expaltext}" /></div>

Then, change:

<tbody style="{$expdisplay}" id="cat_{$forum['fid']}_e">

to

<tbody style="{$expdisplay}" id="cat_{$forum['fid']}_e" name="cat_{$forum['fid']}">

(And don't laugh at the javascript, I'm useless at it too... Wink)
Pages: 1 2