View Full Version : jQuery Multi Level CSS Menu #2 - not showing dropdowns
coleen
04-04-2009, 02:16 PM
Hi Everyone :)
I'm new here, but not new to CSS - although I admit, I still have LOTS to learn. I tried using the exact code from your wonderful menu for the jQuery Multi Level CSS Menu #2 - but even using the code EXACTLY as you have it - it does NOT display the dropdowns for me. I do have a "Header" section of my page and it is very important to place the menu in a fixed position within that header, but even before I changed the css to position the menu - the dropdowns would not display in either FireFox or IE7. Is there something I am missing on this? I really love this menu and would like to use it, so any help would be much appreciated. TIA,
Coleen
Snookerman
04-04-2009, 06:00 PM
Hey coleen!
Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.
Please post a link to the page on your site that contains the problematic script or attach your code so we can check it out and help you.
coleen
04-04-2009, 10:50 PM
Thank you for pointing out the correct way to format a post, I appreciate it.
Here is the link to the menu I'm trying to use:
Script: jQuery Multi Level CSS Menu #2
http://www.dynamicdrive.com/style/csslibrary/item/jquery_multi_level_css_menu_2/
And here is the HTML Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="DefaultLayout.aspx.vb" Inherits="DefaultLayout" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test Home Page</title>
<link href="Consejo.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="jqueryslidemenu.css" />
<!--[if lte IE 7]>
<style type="text/css">
html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/
</style>
<![endif]-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript" src="jqueryslidemenu.js"></script>
</head>
<body class="bckgrndclr">
<form id="form1" runat="server">
<div id="banner" >
<img src="images/CSpalmTree.jpg" alt="Consejo Shores Logo" align="left" class="imgalign"/>
<h1 class="largefont">Consejo Shores</h1>
<h3 class="sloganfont">The best kept secret in Tropical Real Estate</h3>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="255" class="imgalignrt">
<param name="movie" value="images/CS4_flash.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="images/CS4_flash.swf" width="600" height="255">
<!--<![endif]-->
<p>Consejo Shores Photos</p>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
<div id="myslidemenu" class="jqueryslidemenu">
<ul>
<li><a href="http://www.dynamicdrive.com">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Folder 1</a>
<ul>
<li><a href="#">Sub Item 1.1</a></li>
<li><a href="#">Sub Item 1.2</a></li>
<li><a href="#">Sub Item 1.3</a></li>
<li><a href="#">Sub Item 1.4</a></li>
</ul>
</li>
<li><a href="#">Item 3</a></li>
<li><a href="#">Folder 2</a>
<ul>
<li><a href="#">Sub Item 2.1</a></li>
<li><a href="#">Folder 2.1</a>
<ul>
<li><a href="#">Sub Item 2.1.1</a></li>
<li><a href="#">Sub Item 2.1.2</a></li>
<li><a href="#">Folder 3.1.1</a>
<ul>
<li><a href="#">Sub Item 3.1.1.1</a></li>
<li><a href="#">Sub Item 3.1.1.2</a></li>
<li><a href="#">Sub Item 3.1.1.3</a></li>
<li><a href="#">Sub Item 3.1.1.4</a></li>
<li><a href="#">Sub Item 3.1.1.5</a></li>
</ul>
</li>
<li><a href="#">Sub Item 2.1.4</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="http://www.dynamicdrive.com/style/">Item 4</a></li>
</ul>
<br style="clear: left" />
</div>
<div id="container">
<div id="cont_content">
<div id="navigation">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Properties</a></li>
<li><a href="#">Purchase Info</a></li>
<li><a href="#">Belize Info</a></li>
<li><a href="#">Photo Gallery</a></li>
<li><a href="#">About/Contact Us</a></li>
</ul>
</div>
<div id="content">
Page content goes here
</div>
</form>
</body>
</html>
And the .js and .css files I added exactly as they are on the link - if you need me to post them, I'll be glad to, but they are identical. Oh here is my Consejo.css:
body
{
margin: 0;
padding: 0;
font-family: Verdana, Arial, sans-serif, Helvetica, sans-serif, Trebuchet MS;
color: #000000;
}
.bckgrndclr
{
background-color: #d4e3f0;
}
.aligncenter
{
text-align:center;
}
.imgalign
{
position:fixed;
top: 51px;
left: 70px;
height: 157px;
}
.imgalignrt
{
position:fixed;
top: 3px;
Right: 40px;
}
.largefont
{
font-family: lucida Calligraphy, Bradley Hand ITC, Comic Sans MS, Verdana, Arial, sans-serif, Helvetica;
font-size: 2.5em;
font-weight: bold;
font-style: italic;
font-variant: normal;
width:370px;
color: #000000;
position:fixed;
left:185px;
top:90px;
}
.sloganfont
{
font-family: lucida Calligraphy, Bradley Hand ITC, Comic Sans MS, Verdana, Arial, sans-serif, Helvetica;
font-size: 1em;
font-weight: bold;
font-style: italic;
font-variant: normal;
color: #000000;
position:fixed;
left:140px;
top:141px;
width: 412px;
}
#banner
{
background-image: url(images/backgrnd.jpg);
background-repeat: repeat;
border-bottom: 2px solid #5fa4e3;
width: 100%;
height: 19em; /*260px;*/
position: fixed;
top:0px;
z-index: 3;
}
#container
{
margin-top: 19.5em;
}
#content
{
margin-left: 16em;
margin-right:2em;
}
.cleardiv
{
clear: both;
height: 1em;
}
The only thng I can think of is that the flash file is affecting the dropdowns? If you or anyone else can see any reason why the dropdowns don't work, I'd really appreciate the help. I really like this menu and would like to use it, but can't if I can't get the dropdowns to work. TIA,
Coleen
bluewalrus
04-04-2009, 10:58 PM
Does your flash write anything to the page? Does it display in other browsers for you aside from ie and firefox? It's dropping down for me in safari with the code as this (which has no changes but the javascript and css inside it rather than linked).
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="DefaultLayout.aspx.vb" Inherits="DefaultLayout" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test Home Page</title>
<!--[if lte IE 7]>
<style type="text/css">
html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/
</style>
<![endif]-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
/*********************
//* jQuery Multi Level CSS Menu #2- By Dynamic Drive: http://www.dynamicdrive.com/
//* Last update: Nov 7th, 08': Limit # of queued animations to minmize animation stuttering
//* Menu avaiable at DD CSS Library: http://www.dynamicdrive.com/style/
*********************/
//Specify full URL to down and right arrow images (23 is padding-right to add to top level LIs with drop downs):
var arrowimages={down:['downarrowclass', 'down.gif', 23], right:['rightarrowclass', 'right.gif']}
var jqueryslidemenu={
animateduration: {over: 200, out: 100}, //duration of slide in/ out animation, in milliseconds
buildmenu:function(menuid, arrowsvar){
jQuery(document).ready(function($){
var $mainmenu=$("#"+menuid+">ul")
var $headers=$mainmenu.find("ul").parent()
$headers.each(function(i){
var $curobj=$(this)
var $subul=$(this).find('ul:eq(0)')
this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
this.istopheader=$curobj.parents("ul").length==1? true : false
$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
$curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: arrowsvar.down[2]} : {}).append(
'<img src="'+ (this.istopheader? arrowsvar.down[1] : arrowsvar.right[1])
+'" class="' + (this.istopheader? arrowsvar.down[0] : arrowsvar.right[0])
+ '" style="border:0;" />'
)
$curobj.hover(
function(e){
var $targetul=$(this).children("ul:eq(0)")
this._offsets={left:$(this).offset().left, top:$(this).offset().top}
var menuleft=this.istopheader? 0 : this._dimensions.w
menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
if ($targetul.queue().length<=1) //if 1 or less queued animations
$targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).slideDown(jqueryslidemenu.animateduration.over)
},
function(e){
var $targetul=$(this).children("ul:eq(0)")
$targetul.slideUp(jqueryslidemenu.animateduration.out)
}
) //end hover
}) //end $headers.each()
$mainmenu.find("ul").css({display:'none', visibility:'visible'})
}) //end document.ready
}
}
//build menu with ID="myslidemenu" on page:
jqueryslidemenu.buildmenu("myslidemenu", arrowimages)
</script>
<style type="text/css">
body
{
margin: 0;
padding: 0;
font-family: Verdana, Arial, sans-serif, Helvetica, sans-serif, Trebuchet MS;
color: #000000;
}
.bckgrndclr
{
background-color: #d4e3f0;
}
.aligncenter
{
text-align:center;
}
.imgalign
{
position:fixed;
top: 51px;
left: 70px;
height: 157px;
}
.imgalignrt
{
position:fixed;
top: 3px;
Right: 40px;
}
.largefont
{
font-family: lucida Calligraphy, Bradley Hand ITC, Comic Sans MS, Verdana, Arial, sans-serif, Helvetica;
font-size: 2.5em;
font-weight: bold;
font-style: italic;
font-variant: normal;
width:370px;
color: #000000;
position:fixed;
left:185px;
top:90px;
}
.sloganfont
{
font-family: lucida Calligraphy, Bradley Hand ITC, Comic Sans MS, Verdana, Arial, sans-serif, Helvetica;
font-size: 1em;
font-weight: bold;
font-style: italic;
font-variant: normal;
color: #000000;
position:fixed;
left:140px;
top:141px;
width: 412px;
}
#banner
{
background-image: url(images/backgrnd.jpg);
background-repeat: repeat;
border-bottom: 2px solid #5fa4e3;
width: 100%;
height: 19em; /*260px;*/
position: fixed;
top:0px;
z-index: 3;
}
#container
{
margin-top: 19.5em;
}
#content
{
margin-left: 16em;
margin-right:2em;
}
.cleardiv
{
clear: both;
height: 1em;
}
.jqueryslidemenu{
font: bold 12px Verdana;
background: #414141;
width: 100%;
}
.jqueryslidemenu ul{
margin: 0;
padding: 0;
list-style-type: none;
}
/*Top level list items*/
.jqueryslidemenu ul li{
position: relative;
display: inline;
float: left;
}
/*Top level menu link items style*/
.jqueryslidemenu ul li a{
display: block;
background: #414141; /*background of tabs (default state)*/
color: white;
padding: 8px 10px;
border-right: 1px solid #778;
color: #2d2b2b;
text-decoration: none;
}
* html .jqueryslidemenu ul li a{ /*IE6 hack to get sub menu links to behave correctly*/
display: inline-block;
}
.jqueryslidemenu ul li a:link, .jqueryslidemenu ul li a:visited{
color: white;
}
.jqueryslidemenu ul li a:hover{
background: black; /*tab link background during hover state*/
color: white;
}
/*1st sub level menu*/
.jqueryslidemenu ul li ul{
position: absolute;
left: 0;
display: block;
visibility: hidden;
}
/*Sub level menu list items (undo style from Top level List Items)*/
.jqueryslidemenu ul li ul li{
display: list-item;
float: none;
}
/*All subsequent sub menu levels vertical offset after 1st level sub menu */
.jqueryslidemenu ul li ul li ul{
top: 0;
}
/* Sub level menu links style */
.jqueryslidemenu ul li ul li a{
font: normal 13px Verdana;
width: 160px; /*width of sub menus*/
padding: 5px;
margin: 0;
border-top-width: 0;
border-bottom: 1px solid gray;
}
.jqueryslidemenuz ul li ul li a:hover{ /*sub menus hover style*/
background: #eff9ff;
color: black;
}
/* ######### CSS classes applied to down and right arrow images ######### */
.downarrowclass{
position: absolute;
top: 12px;
right: 7px;
}
.rightarrowclass{
position: absolute;
top: 6px;
right: 5px;
}
</style>
</head>
<body class="bckgrndclr">
<form id="form1" runat="server">
<div id="banner" >
<img src="images/CSpalmTree.jpg" alt="Consejo Shores Logo" align="left" class="imgalign"/>
<h1 class="largefont">Consejo Shores</h1>
<h3 class="sloganfont">The best kept secret in Tropical Real Estate</h3>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="255" class="imgalignrt">
<param name="movie" value="images/CS4_flash.swf" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="images/CS4_flash.swf" width="600" height="255">
<!--<![endif]-->
<p>Consejo Shores Photos</p>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
<div id="myslidemenu" class="jqueryslidemenu">
<ul>
<li><a href="http://www.dynamicdrive.com">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Folder 1</a>
<ul>
<li><a href="#">Sub Item 1.1</a></li>
<li><a href="#">Sub Item 1.2</a></li>
<li><a href="#">Sub Item 1.3</a></li>
<li><a href="#">Sub Item 1.4</a></li>
</ul>
</li>
<li><a href="#">Item 3</a></li>
<li><a href="#">Folder 2</a>
<ul>
<li><a href="#">Sub Item 2.1</a></li>
<li><a href="#">Folder 2.1</a>
<ul>
<li><a href="#">Sub Item 2.1.1</a></li>
<li><a href="#">Sub Item 2.1.2</a></li>
<li><a href="#">Folder 3.1.1</a>
<ul>
<li><a href="#">Sub Item 3.1.1.1</a></li>
<li><a href="#">Sub Item 3.1.1.2</a></li>
<li><a href="#">Sub Item 3.1.1.3</a></li>
<li><a href="#">Sub Item 3.1.1.4</a></li>
<li><a href="#">Sub Item 3.1.1.5</a></li>
</ul>
</li>
<li><a href="#">Sub Item 2.1.4</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="http://www.dynamicdrive.com/style/">Item 4</a></li>
</ul>
<br style="clear: left" />
</div>
<div id="container">
<div id="cont_content">
<div id="navigation">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Properties</a></li>
<li><a href="#">Purchase Info</a></li>
<li><a href="#">Belize Info</a></li>
<li><a href="#">Photo Gallery</a></li>
<li><a href="#">About/Contact Us</a></li>
</ul>
</div>
<div id="content">
Page content goes here
</div>
</form>
</body>
</html>
coleen
04-04-2009, 11:09 PM
Thanks Bluewalrus - Yes, the flash displays just fine in FireFox, IE and Safari; I don't know about any other browsers - I have only tested those. I did not try putting the code in the HTML - I can try that, but honestly I SUCK at JS and am not even positive where/how it should go in the HTML! That's why I copied the .js exactly and made sure to download the arrows and place them at root level (instead of inside my image directory like I normally would) let me try your code and see what happens...I will let you know.
Well - copying and pasting your code into a blank HTML file seems to work - so obviously it is in either the .js or .css file. I will check them both (although I am positive that I did NOT make any changes to either when I copied and created them!) So I will try this again - maybe when I created the file it got corrupted or something (I am developing in VB.Net - so you never know what weird result you will get when adding new scripts!) Thanks for your help and quick response - I appreciate it!
coleen
04-04-2009, 11:57 PM
Well, since I am not familiar enough with js, I believe the problem is in how I am linking to the .js file. As soon as I copied all the js code into a separate file "jqueryslidemenu.js" - the drop downs immediately stopped working!
As I was copying the code to the new file, I found the problem. I missed the </script> tag at the very bottom - it does not need to be included in the separate .js file, and in fact - seems to be what was causing the error!
I do have to position this menu now, but changing the position to fixed shouldn't affect the dropdowns - right?
Thanks so much for your help - I appreciate it!
coleen
04-05-2009, 12:13 AM
Got it! One more question though - the arrows are just too small and I don't really like the look of them - how do I remove them from the Javascript?
bluewalrus
04-05-2009, 06:01 AM
I dont know javascript either but commenting out the img tag would work i believe lines 40-42 on code i gave you before swap to this...
'<!--<img src="'+ (this.istopheader? arrowsvar.down[1] : arrowsvar.right[1])
+'" class="' + (this.istopheader? arrowsvar.down[0] : arrowsvar.right[0])
+ '" style="border:0;" />-->'
And fixed shouldnt make a difference with the drop down
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.