Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

CSS/JavaScript Dropdown Menu v1.0e

Asked Modified Viewed 50,992 times
S
smokeman
S
  • Veteran Member, joined since
  • Contributed 920 posts on the community forums.
  • Started 79 threads in the forums
  • Started this discussions
asked
Veteran Member

[mp]115[/mp]
0 replies

85 posts

K
KasteR
K
KasteR 10
  • Senior Member, joined since
  • Contributed 290 posts on the community forums.
  • Started 1 thread in the forums
answered
Senior Member

JoiNNN was right about the database. The value is controlled through the admin panel, but you are limited to which fonts you may actually choose. They're predefined within the drop down selection, and stored into a table in the db.

In your situation, I would simply remove the font portion of the css, to not specify any particular font. This would allow your current themes font to naturally set it'self as the font for your menu.

Alter the #nav attribute, which is cleverly stored within menu.php. Here is the altered version:
[syntaxhighlighter brush=css,first-line=1,highlight=0,collapse=false,html-script=false]<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright © 2002 - 2012 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Name: menu.php
| Author : Smokeman
| Email: smokeman@esenet.dk
| Web: http://www.phpfusion-tips.dk/
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
include INFUSIONS."deluxe_dropdown_menu/infusion_db.php";

add_to_head("<script src='".INFUSIONS."deluxe_dropdown_menu/includes/js/stuHover.js' type='text/javascript'></script>"wink;

echo "
<div class='preload1'></div>
<div class='preload2'></div>
<div class='preload3'></div>
<div class='preload4'></div>
";

// Read the menus
$m = array();
$msql = dbquery("SELECT * FROM ".DB_MENUS." ORDER BY menu_order"wink;
while ($mdata = dbarray($msql))
{
$m[] = $mdata;
}

// Parse links and names
foreach ($m as &$mdata)
{
if (!preg_match("!^(ht|f)tp(s)?://!i", $mdata['menu_link']))
{
$mdata['menu_link'] = BASEDIR.$mdata['menu_link'];
}
$mdata['menu_name'] = parseubb($mdata['menu_name'], "b|i|u|img|color"wink;
}

// Make the menu
menuitem($m);

// ============================== Get Data From Menu Settings ============================== //
$menusettings = dbarray(dbquery("SELECT * FROM ".DB_MENU_SETTINGS));

// ============================== Adjusting The Width ============================== //
$width1 = $menusettings['mset_width'] - 10;
$width2 = $menusettings['mset_width'] - 2;

if ($menusettings['mset_set_style'] == "0"wink {
// ============================== Load Pre-Installed Templates CSS ============================== //
add_to_head("<link rel='stylesheet' type='text/css' href='".INFUSIONS."deluxe_dropdown_menu/templates/".$menusettings['mset_templates']."/".$menusettings['mset_templates'].".css' />"wink;
} else {
// ============================== Load User Defined Template CSS ============================== //
add_to_head("<style type='text/css'>
/* ================================================================
This copyright notice must be kept untouched in the stylesheet at
all times.

The original version of this stylesheet and the associated (x)html
is available at http://www.stunicholls.com/ (...)
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This stylesheet and the associated (x)html may be modified in any
way to fit your requirements.

Very highly modified by Smokeman
so it fits for the DeLuxe Dropdown Menu v1.1
=================================================================== */

/* ---------- Preload Hover Images ---------- */
.preload1 {background: url(".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_main_img']."wink;}
.preload2 {background: url(".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_main_arrow_himg']."wink;}

/* ---------- Hide The Next level ---------- */
#nav ul,
#nav li:hover ul ul,
#nav li:hover li:hover ul ul,
#nav li:hover li:hover li:hover ul ul,
#nav li:hover li:hover li:hover li:hover ul ul
{position:absolute; left:-9999px; top:-9999px; width:0; height:0; margin:0; padding:0; list-style:none;}

/* ---------- All Link Colors ---------- */
#nav li a
{color: black;}

/* ---------- Position Of The Dropdown's ---------- */
#nav li:hover {position:relative; z-index:200;}

/* ---------- Main Menu ---------- */
#nav {padding:0; margin:0; list-style:none; height:35px; background: url('".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_main_img']."'wink repeat-x; background-color: #".$menusettings['mset_main_bgcolor']."; position:relative; z-index:500;}
#nav li.top {display:block; float:left; height:35px;}
#nav li a.top_link {float:left; display:block; height:35px; line-height:33px; color:#CCC; text-decoration: none; font-size:".$menusettings['mset_textsize']."px; font-weight:bold; padding:0 0 0 12px; cursor:pointer;}
#nav li div {float:left; display:block; margin-left:12px; padding-right:24px; height:35px; background: url('".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_main_img']."'wink right top no-repeat;}
#nav li div.down {float:left; display:block; margin-left:12px; padding-right:24px; height:35px; background: url('".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_main_arrow_img']."'wink right top no-repeat; background-color: #".$menusettings['mset_main_bgcolor_arrow'].";}
#nav li.top:hover{color:#".$menusettings['mset_htextcolor_main']."; background: url('".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_main_himg']."'wink no-repeat;}
#nav li:hover a.top_link {color:#".$menusettings['mset_htextcolor_main'].";}
#nav li:hover div {background: url('".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_main_himg']."'wink right top no-repeat; background-color: #".$menusettings['mset_main_hbgcolor'].";}
#nav li:hover div.down {background: url('".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_main_arrow_himg']."'wink right top no-repeat; background-color: #".$menusettings['mset_main_hbgcolor_arrow'].";}

/* ---------- Sub Menu 1 ---------- */
#nav li ul li a:hover
{color: #".$menusettings['mset_htextcolor_sub1'].";}
#nav li:hover ul
{left:".$menusettings['mset_width']."px; top:-4px; background: #".$menusettings['mset_sub1_bgcolor']."; padding:3px; border:1px solid #".$menusettings['mset_bordercol_sub1']."; white-space:nowrap; width:".$menusettings['mset_width']."px; z-index:400; height:auto;}
#nav li:hover ul.sub
{left: 1px; top:35px; background: #".$menusettings['mset_sub1_bgcolor']."; padding:3px; border:1px solid #".$menusettings['mset_bordercol_sub1']."; white-space:nowrap; width:".$menusettings['mset_width']."px; height:auto; z-index:300;}
#nav li:hover ul.sub li
{display:block; height:20px; position:relative; float:left; width:".$menusettings['mset_width']."px; font-weight:normal;}
#nav li:hover ul.sub li a
{display:block; font-size:".$menusettings['mset_textsize']."px; height:18px; width:".$width2."px; line-height:18px; text-indent:5px; text-decoration:none;border:1px solid #".$menusettings['mset_sub1_bgcolor'].";}
#nav li:hover ul.sub li a:hover
{background:#".$menusettings['mset_sub1_hbgcolor']."; border-color:#".$menusettings['mset_hbordercol_sub1'].";}
#nav li:hover ul.sub li a.fly:hover
{background:#".$menusettings['mset_sub1_hbgcolor']." url(".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_sub_arrow_himg']."wink ".$width1."px 6px no-repeat;}
#nav li:hover a.fly
{background:#".$menusettings['mset_sub1_hbgcolor']." url(".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_sub_arrow_himg']."wink ".$width1."px 6px no-repeat; border-color:#".$menusettings['mset_hbordercol_sub1'].";}
#nav li:hover li a
{border-color:#".$menusettings['mset_sub1_bgcolor'].";}
#nav li:hover li a:hover
{border-color:#".$menusettings['mset_hbordercol_sub1']."; background:#".$menusettings['mset_sub1_hbgcolor'].";}
#nav li:hover li a.fly
{background:#".$menusettings['mset_sub1_bgcolor']." url(".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_sub_arrow_img']."wink ".$width1."px 6px no-repeat; border-color:#".$menusettings['mset_sub1_bgcolor'].";}
#nav li:hover li a.fly:hover
{background:#".$menusettings['mset_sub1_hbgcolor'].";}

/* ---------- Sub Menu 2 ---------- */
#nav li ul li ul li a:hover
{color: #".$menusettings['mset_htextcolor_sub2'].";}
#nav li:hover li:hover ul
{left:".$menusettings['mset_width']."px; top:-4px; background: #".$menusettings['mset_sub2_bgcolor']."; padding:3px; border:1px solid #".$menusettings['mset_bordercol_sub2']."; white-space:nowrap; width:".$menusettings['mset_width']."px; z-index:400; height:auto;}
#nav li:hover li:hover ul.sub
{left: 1px; top:35px; background: #".$menusettings['mset_sub2_bgcolor']."; padding:3px; border:1px solid #".$menusettings['mset_bordercol_sub2']."; white-space:nowrap; width:".$menusettings['mset_width']."px; height:auto; z-index:300;}
#nav li:hover li:hover ul.sub li
{display:block; height:20px; position:relative; float:left; width:".$menusettings['mset_width']."px; font-weight:normal;}
#nav li:hover li:hover ul.sub li a
{display:block; font-size:".$menusettings['mset_textsize']."px; height:18px; width:".$width2."px; line-height:18px; text-indent:5px; text-decoration:none;border:1px solid #".$menusettings['mset_sub2_bgcolor'].";}
#nav li:hover li:hover ul.sub li a:hover
{background:#".$menusettings['mset_sub2_hbgcolor']."; border-color:#".$menusettings['mset_hbordercol_sub2'].";}
#nav li:hover li:hover ul.sub li a.fly:hover
{background:#".$menusettings['mset_sub2_hbgcolor']." url(".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_sub_arrow_himg']."wink ".$width1."px 6px no-repeat;}
#nav li:hover li:hover a.fly
{background:#".$menusettings['mset_sub1_hbgcolor']." url(".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_sub_arrow_himg']."wink ".$width1."px 6px no-repeat; border-color:#".$menusettings['mset_hbordercol_sub1'].";}
#nav li:hover li:hover li a
{border-color:#".$menusettings['mset_sub2_bgcolor'].";}
#nav li:hover li:hover li a:hover
{border-color:#".$menusettings['mset_hbordercol_sub2']."; background:#".$menusettings['mset_sub2_hbgcolor'].";}
#nav li:hover li:hover li a.fly
{background:#".$menusettings['mset_sub2_bgcolor']." url(".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_sub_arrow_img']."wink ".$width1."px 6px no-repeat; border-color:#".$menusettings['mset_sub2_bgcolor'].";}
#nav li:hover li:hover li a.fly:hover
{background:#".$menusettings['mset_sub2_hbgcolor'].";}

/* ---------- Sub Menu 3 ---------- */
#nav li ul li ul li ul li a:hover
{color: #".$menusettings['mset_htextcolor_sub3'].";}
#nav li:hover li:hover li:hover ul
{left:".$menusettings['mset_width']."px; top:-4px; background: #".$menusettings['mset_sub3_bgcolor']."; padding:3px; border:1px solid #".$menusettings['mset_bordercol_sub3']."; white-space:nowrap; width:".$menusettings['mset_width']."px; z-index:400; height:auto;}
#nav li:hover li:hover li:hover ul.sub
{left: 1px; top:35px; background: #".$menusettings['mset_sub3_bgcolor']."; padding:3px; border:1px solid #".$menusettings['mset_bordercol_sub3']."; white-space:nowrap; width:".$menusettings['mset_width']."px; height:auto; z-index:300;}
#nav li:hover li:hover li:hover ul.sub li
{display:block; height:20px; position:relative; float:left; width:".$menusettings['mset_width']."px; font-weight:normal;}
#nav li:hover li:hover li:hover ul.sub li a
{display:block; font-size:".$menusettings['mset_textsize']."px; height:18px; width:".$width2."px; line-height:18px; text-indent:5px; text-decoration:none;border:1px solid #".$menusettings['mset_sub3_bgcolor'].";}
#nav li:hover li:hover li:hover ul.sub li a:hover
{background:#fff; border-color:#".$menusettings['mset_hbordercol_sub3'].";}
#nav li:hover li:hover li:hover ul.sub li a.fly:hover
{background:#fff url(".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_sub_arrow_himg']."wink ".$width1."px 6px no-repeat;}
#nav li:hover li:hover li:hover a.fly
{background:#".$menusettings['mset_sub2_hbgcolor']." url(".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_sub_arrow_himg']."wink ".$width1."px 6px no-repeat; border-color:#".$menusettings['mset_hbordercol_sub2'].";}
#nav li:hover li:hover li:hover li a
{border-color:#".$menusettings['mset_sub3_bgcolor'].";}
#nav li:hover li:hover li:hover li a:hover
{border-color:#".$menusettings['mset_hbordercol_sub3']."; background:#".$menusettings['mset_sub3_hbgcolor'].";}
#nav li:hover li:hover li:hover li a.fly
{background:#".$menusettings['mset_sub3_bgcolor']." url(".INFUSIONS."deluxe_dropdown_menu/images/".$menusettings['mset_sub_arrow_img']."wink ".$width1."px 6px no-repeat; border-color:#".$menusettings['mset_sub3_bgcolor'].";}
#nav li:hover li:hover li:hover li a.fly:hover
{background:#".$menusettings['mset_sub3_hbgcolor'].";}

</style>"wink;
}
function menucount(&$m, $id)
{
$n = 0;
foreach($m as $mdata)
if ($mdata['menu_cat'] == $id) $n++;

return $n;
}
function menuitem(&$m, $id = 0, $level = 0)
{
if (menucount($m, $id) > 0)
{
// Set ul class/id
$ul_class = '';
if ($level == 0) $ul_class = " id='nav'";
if ($level == 1) $ul_class = " class='sub'";
echo "<ul".$ul_class.">";

foreach($m as $mdata)
{
if ($mdata['menu_cat'] == $id && checkgroup($mdata['menu_access']))
{
$link_target = ($mdata['menu_window'] == "1" ? " target='_blank'" : ""wink;

if ($level == 0 && menucount($m, $mdata['menu_id']) > 0)
{
$div_start = "<div class='down'>";
$div_end = "</div>";
}
else if ($level == 0)
{
$div_start = "<div>";
$div_end = "</div>";
}
else
{
$div_start = "";
$div_end = "";
}

if ($level == 0)
{
$link_class = " class='top_link'";
}
else if (menucount($m, $mdata['menu_id']) > 0)
{
$link_class = " class='fly'";
}
else
{
$link_class = "";
}

if ($level == 0)
{
$li_class = " class='top'";
}
else
{
$li_class = "";
}

if ($mdata['menu_name'] !== "---" && $mdata['menu_link'] == "---"wink {
echo "<li".$li_class.">".$div_start."<b>".$mdata['menu_name']."</b>".$div_end."\n";
} else if ($mdata['menu_name'] == "---" && $mdata['menu_link'] == "---"wink {
echo "<li".$li_class.">".$div_start."<hr />".$div_end."\n";
} else {
echo "<li".$li_class.">".$div_start."<a href='".$mdata['menu_link']."'".$link_target."".$link_class.">".$mdata['menu_name']."</a>".$div_end."\n";
}
menuitem($m, $mdata['menu_id'], $level + 1);
echo "</li>\n";
}
}
echo "</ul>\n";
}
}
?>[/syntaxhighlighter]The changes take place on line 99. If you'd like to see my test site as an example follow the link bellow.
[ulist=circle]Ref: http://dev.fusion.kaster.us[/ulist][ulist=circle]This site's theme, and or content/validity may change at any time.[/ulist]
0 replies
C
Charon
C
Charon 10
Nothing Like the Taste of Death to Help You Appreciate Life
  • Junior Member, joined since
  • Contributed 32 posts on the community forums.
  • Started 3 threads in the forums
answered
Junior Member

Have you noticed that the main menu fonts are still arial. subheaders and sub levels are changed?

++

Maybe the fonts are bold in Main Menu so it is perceived as Arial.

Am I going to far asking how can I edit the bold or normal font .
Edited by Charon on 12-03-2013 05:55,
0 replies
K
KasteR
K
KasteR 10
  • Senior Member, joined since
  • Contributed 290 posts on the community forums.
  • Started 1 thread in the forums
answered
Senior Member

If you're looking at the value being displayed from menu_admin.php, then yes, it is going to say Arial if that's what you had chosen last.

This is because we have not modified that page, to say, or show anything otherwise. Here, this is how that portion of the page is coded:
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false] <select name='textfont' class='textbox'>
<option value='arial'".($menusettings2['mset_textfont'] == 'arial' ? " selected" : ""wink.">Arial</option>
<option value='verdana'".($menusettings2['mset_textfont'] == 'verdana' ? " selected" : ""wink.">Verdana</option>
<option value='Helvetica'".($menusettings2['mset_textfont'] == 'Helvetica' ? " selected" : ""wink.">Helvetica</option>
<option value='sans-serif'".($menusettings2['mset_textfont'] == 'sans-serif' ? " selected" : ""wink.">Sans-Serif</option>
</select>[/syntaxhighlighter]Try changing the value. It shouldn't matter what you select, now that we've modified the css. The displayed font should be your theme's font.

What may be different, at least on my page, is the main menu text is bold. The sub-menu items are not.
0 replies
C
Charon
C
Charon 10
Nothing Like the Taste of Death to Help You Appreciate Life
  • Junior Member, joined since
  • Contributed 32 posts on the community forums.
  • Started 3 threads in the forums
answered
Junior Member

I think we were posting at the same time. This is exactly what I ve thought. Possibly it is because of bold thing. I will try to modify to make it not bold.

in line 101 it says font-weight:bold
If i configure it, it will be sold possibly.


Thanks heaps Kaster

Regards
0 replies
K
KasteR
K
KasteR 10
  • Senior Member, joined since
  • Contributed 290 posts on the community forums.
  • Started 1 thread in the forums
answered
Senior Member

No worries, and you're correct. That will remove the boldness. ;)
0 replies
— 4 months later —
J
Joe Kriz
J
  • Senior Member, joined since
  • Contributed 281 posts on the community forums.
  • Started 39 threads in the forums
answered
Senior Member

Quote

Remus wrote:

A very nice infusion :D

I've made one main modification by putting it in the sub-header navbar instead of letting it create a new navbar above it. I'd like to make one more modification: to use a &middot at the beginning of each <li>. However, the &middot appears on a line above the hyperlink and I really cannot figure out why.

Effectively, each list item should echo in html as:
[syntaxhighlighter brush=html,first-line=1,highlight=0,collapse=false,html-script=false]<li> &middot; <a href='link.php' target='_blank'>Menu Item</a></li>[/syntaxhighlighter]

An example of the code taken from menu.php - note that I'm skipping using THEME_BULLET to take that out of my hunt:

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]echo "<li> &middot; <a href='".$mdata['menu_link']."'".$link_target.">".$mdata['menu_name']."</a>\n";[/syntaxhighlighter]

I've tried ruling out margin, padding and z-index simply because this symbol is inside the <li>.

Is there anything you can suggest I do to solve this? Thank you!

I realize this thread is a few months old but it is still on the front page.

I too am trying to get the middot.
Did you every get it working properly?

I am also trying to get the Date and Time in the DDM.

I have added this code to my Theme instead of adding it as another banner in the Main Settings.
//New Header in theme for Deluxe Drop Down Menu
   echo "<table cellpadding='0' cellspacing='0' width='100%' align='center'>\n<tr>\n";
   echo "<td class='full-header'>\n".showbanners()."</td>\n";
   echo "</tr>\n</table>\n";

   echo "<table cellpadding='0' cellspacing='0' width='100%' align='center'>\n<tr>\n";
   echo "<td>\n";
   include INFUSIONS."deluxe_dropdown_menu/menu.php";
   echo "</td>\n";
   echo "</tr>\n</table>\n";

Thanks for a great infusion Smokeman.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 85 posts
  • Votes 0 votes
  • Topic users 23 members

0 participants

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet