/    Sign up×
Community /Pin to ProfileBookmark

Vertical Flyout Menu Problems

I am trying to create a vertical flyout menu and I’m pulling from several different examples to make mine. Thing is, won’t work in IE, duh. So I tried using suckerfish to fix my hover issues but it still wont work.

Here’s the website with the test menu: [url]http://exco.org/testmenu.php[/url]

Here’s the suckerfish function I’m using: [url]http://www.htmldog.com/articles/suckerfish/[/url]

Here’s the css I’m using :

[code=php]
#menu {
height:150px;
font-size:90%;
margin:25px 0 50px 15px;
}

#menu ul {
position:relative;
z-index:500;
padding:0;
margin:0;
list-style-type:none;
width:150px;
}

#menu li {
background:#d4d8bd;
height:26px;
/* for IE7 */
float:left;
}

#menu li.sub {background:#d4d8bd url(sub.gif) no-repeat right center;}

#menu a, .menu a:visited {
display:block;
text-decoration:none;
height:25px;
line-height:25px;
width:149px;
color:#000;
text-indent:5px;
border:1px solid #fff;
border-width:0 1px 1px 1px;
}

#menu li:hover, #menu li.sfhover {position:relative;}

#menu a:active, #menu a:focus {color:#efa; background:#aa7;}

/* retain the hover colors for each sublevel IE7 and Firefox etc */
#menu li:hover > a{color:#efa; background:#aa7;}

/* hide the sub levels and give them a position absolute so that they take up no room */
#menu li ul {
visibility:hidden;
position:absolute;
top:-30px;
/* set up the overlap (minus the overrun) */
left:100px;
/* set up the overrun area */
padding:30px;
/* this is for IE to make it interpret the overrrun padding */
background:transparent url(transparent.gif);
}

#menu li:hover > ul, #menu li.sfhover > ul {
visibility:visible;
background-color: red;
}[/code]

Thanks for any help!

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@CentauriJun 04.2008 — As the child selector won't work in IE, dealing with the inheritance of multi level dropdowns can be interesting. As outlined in the htmldog suckerfish article, the css for your menu can be :[CODE]#menu {
font-size: 90%;
margin: 25px 0 50px 15px;
}
#menu ul {
margin: 0;
padding: 0;
width: 150px;
background-color: #FFFFFF;
}
#menu li {
list-style: none;
position: relative;
float: left;
width: 100%;
}
#menu a {
display: block;
height: 25px;
line-height: 25px;
text-decoration: none;
color: #000000;
text-indent: 5px;
border: 1px solid #FFF;
border-width: 0 1px 1px;
background-color: #D4D8BD;
}
#menu ul ul {
position: absolute;
top: 0px;
left: -999em;
}
#menu li:hover ul a, #menu li.sfhover ul a,
#menu li:hover ul ul a, #menu li.sfhover ul ul a,
#menu li:hover ul ul ul a, #menu li.sfhover ul ul ul a,
#menu li:hover ul ul ul ul a, #menu li.sfhover ul ul ul ul a {
background-color: #D4D8BD;
color: #000000;
}
#menu li:hover a, #menu li.sfhover a,
#menu li li:hover a, #menu li li.sfhover a,
#menu li li li:hover a, #menu li li li.sfhover a,
#menu li li li li:hover a, #menu li li li li.sfhover a,
#menu li li li li li:hover a, #menu li li li li li.sfhover a {
color: #EFA;
background-color: #AA7;
}
#menu li:hover ul ul, #menu li.sfhover ul ul,
#menu li:hover ul ul ul, #menu li.sfhover ul ul ul,
#menu li:hover ul ul ul ul, #menu li.sfhover ul ul ul ul {
left: -999em;
}
#menu li:hover ul, #menu li.sfhover ul,
#menu li li:hover ul, #menu li li.sfhover ul,
#menu li li li:hover ul, #menu li li li.sfhover ul,
#menu li li li li:hover ul, #menu li li li li.sfhover ul {
left: 150px;
}
[/CODE]
Looks daunting, but works well.

I would also link the javascript via a conditional comment, as only IE less than v7 needs to see it :[CODE]<!--[if lt IE 7]><script src="includes/menu.js" type="text/javascript"></script><![endif]-->
[/CODE]
Copy linkTweet thisAlerts:
@bejitto101authorJun 04.2008 — Thanks a ton for your help. Worked well for my example, but when I tried to implement it I got some problems.

Here's the problem site: http://depts.washington.edu/asuwxpcl/testindex.php

Any idea what is happening there? Is it because the containing element is also floating that it does that? Its really funky. Should I just go back to the "visibility:hidden;" way of doing of it instead of just putting it to the left of the screen?
Copy linkTweet thisAlerts:
@CentauriJun 04.2008 — Originally, you had the menu within a div with the id of "menu", but now you have applied that id to the <ul> instead, which changes the menu css structure. If you remove the id from the <ul> and rename #topright to "menu" and transfer the #topright styles to #menu in the css it will then work.

What is this "overrun padding, and why is it there?

As the menu is on the right, the dropdowns would probably be better if they were to the left - to do that change the hover position from left:200px; to right:0;
Copy linkTweet thisAlerts:
@bejitto101authorJun 04.2008 — Ah ha! Thanks, I was switching from a regular horizontal drop menu to this and I forgot to change that. Much thanks!

As for the overrun padding, its just so the user can go outside the menu box a little without the sub-categories disappearing once its selected. It allows for a little error on users part if they have a shaky hand or something? I know I've had problems with menus that are a little two slow and it was hard selecting some of the sub elements. Make sense?

Also if I set right: 0; then nothing shows up when I hover over menu elements. You can check http://depts.washington.edu/asuwxpcl/testindex.php to see it.
Copy linkTweet thisAlerts:
@CentauriJun 04.2008 — Also if I set right: 0; then nothing shows up when I hover over menu elements.[/QUOTE]

I must have been half asleep. Of course it won't as the left is still at -999em. Changing the left:200px to left:-260px will give a left flyout menu.
×

Success!

Help @bejitto101 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...