MyBB Community Forums

Full Version: Javascript Not Working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey,

In a couple of themes I've added a simple dropdown menu using the code from here: http://javascript-array.com/scripts/jque...down_menu/

Unfortunately I failed to notice this has stopped javascript working properly. The show/hide does not work on the thead(s) and nor does the quick login.

Does anyone know how I can fix this?

Thanks,
Clarkie
That's what's known as a conflict. There are a few tutorials here on fixing the issue. Here's one from my own site: http://www.mypurebb.com/254-jquery-and-mybb/
Edit: beaten - and with the same link lol
You've just given me something that looks brilliant.. if I understood Javascript. I'm going to try and figure out what I need to do though. Thanks for the link both of you. Smile
You added this to your template, right?
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js" type="text/javascript"></script>
Right underneath add:
<script type="text/javascript">jQuery.noConflict();</script>
Actually no, I downloaded the jquery file and uploaded it myself but I get what you mean. Smile

You fixed it genius'!

+Rep to both of you - I can't really choose a best answer because there's 2 identical ones...
Oh wait - I lied. The dropdown menu now doesn't work lol.

I added that script code into the headerinclude if that makes any difference.
I moved it to the header_welcomeblock_member but it's no different.
I made some changes to the menu script for it to work:
var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
   ddmenuitem = jQuery(this).find('ul').css('visibility', 'visible');}

function jsddm_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

jQuery(document).ready(function($)
{  $('#jsddm > li').bind('mouseover', jsddm_open)
   $('#jsddm > li').bind('mouseout',  jsddm_timer)});

document.onclick = jsddm_close;
Hmm still not working. The same menu is used in the 1 Company theme that is on the mods site (it's my theme) so you can download it and see if you can fix it in that. I'm off to bed so will look again tomorrow.Smile

Thanks for your help though.
If you wish, I can take a look for you. PM me login information for the ACP and I will see if I can fix it for you.
Okay thanks, I'll upload it to my dev server tomorrow and send you the details.
I PMed the details from my phone last night.
If anyone else feels they can help please let me know as Aries-Belgium hasn't made any changes in the ACP (may have logged in - may not).