MyBB Community Forums

Full Version: JavaScript Dropdown Menus Explained
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8
I'm trying to have two drop down buttons in the same menu. The first half (colored blue) works (the forums button), but the second half (colored red) doesn't work (the donate button). what am i doing wrong?

Quote:<li><a href="{$mybb->settings['bburl']}/index.php" id="drop_down" class="index"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/icons/forums.png" alt="" title="" />Forums</a></li>
<div id="drop_down_popup" class="popup_menu" style="display: none;">
<br /><div class="popup_item_container"><li><a href="{$mybb->settings['bburl']}/index.php" class="index" class="popup_item"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/icons/forums.png" alt="" title="" />Forums</a></li></div><br />
<div class="popup_item_container"><li><a href="{$mybb->settings['bburl']}/portal.php" class="portal" class="popup_item"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/icons/home.png" alt="" title="" />{$lang->toplinks_portal}</a></li></div><br />
<div class="popup_item_container"><li><a href="{$mybb->settings['bburl']}/search.php" class="search" class="popup_item"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/icons/search.png" alt="" title="" />{$lang->toplinks_search}</a></li></div><br />
<div class="popup_item_container"><li><a href="{$mybb->settings['bburl']}/memberlist.php" class="members" class="popup_item"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/icons/memberlist.png" alt="" title="" />Members</a></li></div><br />
<div class="popup_item_container"><li><a href="{$mybb->settings['bburl']}/misc.php?action=help" class="help" class="popup_item"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/icons/help.png" alt="" title="" />{$lang->toplinks_help}</a></li></div><br />
</div>
<script type="text/javascript">
// <!--
if(use_xmlhttprequest == "1")
{
new PopupMenu("drop_down");
}
// -->
</script>
Quote:<li><a href="{$mybb->settings['bburl']}/donate.php" id="donaters"><img src="{$mybb->settings['bburl']}/tera/donate.png" alt="" title="" />Donate</a></li>
<div id="donaters_popup" class="popup_menu" style="display: none;">
<br /><div class="popup_item_container"><li><a href="{$mybb->settings['bburl']}/donate.php" class="popup_item"><img src="http://codwiiforums.com/images/tera/donate.png" alt="" title="" />Donate</a></li></div><br />
<div class="popup_item_container"><li><a href="{$mybb->settings['bburl']}/donate.php?action=top_donators" class="popup_item"><img src="http://codwiiforums.com/images/tera/top.png" alt="" title="" />Top Donators</a></li></div><br />
</div>
<script type="text/javascript">
// <!--
if(use_xmlhttprequest == "1")
{
new PopupMenu("drop_down");
}
// -->
</script>
(2011-01-08, 04:38 AM)~Rs Wrote: [ -> ]<script type="text/javascript">
// <!--
if(use_xmlhttprequest == "1")
{
new PopupMenu("drop_down");
}
// -->
</script>

You've just forgot to change the ID for the JavaScript. Smile

thank you, that was a stupid mistake on my part Sad
I've added one drop down navigation item on my navigation bar, though it doesn't work when I try to add another.

How do I fix this?
(2010-11-22, 11:03 PM)AJS Wrote: [ -> ]Red: This is the menu ID, they must all be identical within the menu and unique to that menu. You can't have the same ID for different menus.

(2011-01-14, 11:48 PM)AJS Wrote: [ -> ]
(2010-11-22, 11:03 PM)AJS Wrote: [ -> ]Red: This is the menu ID, they must all be identical within the menu and unique to that menu. You can't have the same ID for different menus.

I know, and I saw that you posted that as a reply to someone else's...

But what do I need to change? Can I just change it to anything?

Because I've changed them all to example_menu2 and it still doesn't work.
How am I supposed to know why it isn't working without a link or a copy of the code you're using!?!
(2011-01-14, 11:54 PM)AJS Wrote: [ -> ]How am I supposed to know why it isn't working without a link or a copy of the code you're using!?!

My apologies, lol.

This is the drop down menu that is working:
<li><a href="#" id="example_menu"><img src="http://rshub.net/yt.png" width="16" height="16">Social Feeds</a> 

<div id="example_menu_popup" class="popup_menu" style="display: none;">

	<div class="popup_item_container"><a href="http://twitter.com/rshubnet" class="popup_item"><img src="http://rshub.net/wp-content/themes/suffusion/images/twitter/twitter-00.png" width="16" height="16">Twitter</a></div>

	<div class="popup_item_container"><a href="http://youtube.com/RSHubNET" class="popup_item"><img src="http://rshub.net/yt.png" width="16" height="16">YouTube</a></div>


</div>

<script type="text/javascript">

// <!--

	if(use_xmlhttprequest == "1")

	{

		new PopupMenu("example_menu");

	}

// -->

</script></li>

This is the drop down menu that isn't working:
<li><a href="#" id="example_menu2"><img src="http://rshub.net/forum/a/members.png">Community</a> 

<div id="example_menu_popup2" class="popup_menu" style="display: none;">

	<div class="popup_item_container"><a href="{$mybb->settings['bburl']}/search.php" class="popup_item"><img src="http://rshub.net/forum/a/search.png">Search</a></div>

	<div class="popup_item_container"><a href="{$mybb->settings['bburl']}/memberlist.php" class="popup_item"><img src="http://rshub.net/forum/a/members.png">Members</a></div>

	<div class="popup_item_container"><a href="{$mybb->settings['bburl']}/misc.php?action=help" class="popup_item"><img src="http://rshub.net/forum/a/help.png">Help</a></div>

</div>

<script type="text/javascript">

// <!--

	if(use_xmlhttprequest == "1")

	{

		new PopupMenu("example_menu2");

	}

// -->

</script></li>

And my forum link is http://rshub.net/forum/
div id="example_menu_popup2"

Should be:
div id="example_menu2_popup"
(2011-01-15, 12:04 AM)AJS Wrote: [ -> ]
div id="example_menu_popup2"

Should be:
div id="example_menu2_popup"

Oh wow, you're good.

Thank you so much!
Pages: 1 2 3 4 5 6 7 8