PDA

View Full Version : CSS Help!



patchkinz
Mar 26th, 2009, 05:08 PM
Hey everyone,

I would like the CSS for a sub menu off a submenu :)

Help would be much appreciated! Here is my CSS code:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<title>IzzyMenu.com</title>

<script type="text/javascript" src="/chrome.js"></script>

</head>

<body>

<center>

<style>
#MainMenu
{
background:#FFF url(images/bmid_086.gif);
border:2px solid #00000;
margin:0;
}
#tab
{
top:0;
height:0;
background:repeat-x top;
margin:0;
}
#tab ul
{
list-style:none;
float:left;
margin:0;
padding:0;
}
#tab li
{
display:inline;
float:left;
margin:0;
padding:0;
}
#tab a
{
background:#000 url(images/bright_086.gif) no-repeat right top;
text-decoration:none;
border:0;
display:block;
float:left;
margin:0;
padding:0;
}
#tab a span
{
display:block;
background:url(images/bleft_086.gif) no-repeat left top;
font-family:\"Times New Roman\", Times, serif;
font-size:19px;
font-style:italic;
text-decoration: none;
color:#FFF;
font-weight:bold;
line-height:29px;
padding:0 15px 0 13px;
}
#tab a:hover,#tab li.item_active a
{
background-position:right bottom;
}
#tab a:hover span,#tab li.item_active a span
{
background-position:left bottom;
color:#009;
font-weight:bold;
font-style:italic;
text-decoration:none;
}
.dropmenudiv
{
position:absolute;
top:0;
float:left;
display:block;
visibility:hidden;
border:2px solid #00000;
background:#FFF url(images/bmid_086.gif);
color:#FFF;
z-index:100;
text-decoration:none;
padding:0;
}
.dropmenudiv ul
{
list-style:none;
margin:0;
padding:0;
}
.dropmenudiv li
{
display:inline;
margin:0;
padding:0;
}
.dropmenudiv a:link,.dropmenudiv a:visited
{
width:180px;
display:block;
border:0;
color:#FFFFF;
background:url(images/bleft_086.gif) no-repeat left top;
font-weight:bold;
font-style:italic;
text-decoration:none;
margin:0;
padding:0;
}
.dropmenudiv a span
{
display:block;
line-height:29px;
background:url(images/bright_086.gif) no-repeat right top;
font-family:\"Times New Roman\", Times, serif;
font-size:19px;
font-style:italic;
color:#FFFFF;
float:none;
padding:0 15px 0 13px;
}
.dropmenudiv a:hover
{
border:0;
background-position:left bottom;
font-weight:bold;
font-style:italic;
text-decoration:none;
color:#009;
}
.dropmenudiv a:hover span
{
background-position:right bottom;
color:#009;
font-weight:700;
font-style:italic;
}

</style>
<div id="MainMenu">
<div id="tab">
<ul>
<li class="item_active"><a href="index.html"><span>Home</span></a></li>
<li><a href="Community/index.php" onMouseover="cssdropdown.dropit(this,event,'dropmenu_734766')"><span>Community</span></a></li>
<li><a href="URL"><span>Menu</span></a></li>
<li><a href="Search.php"><span>Search</span></a></li>
<li><a href="blog" onMouseover="cssdropdown.dropit(this,event,'dropmenu_509055')"><span>Blog</span></a></li>
<li><a href="URL"><span>Menu</span></a></li>
<li><a href="URL" onMouseover="cssdropdown.dropit(this,event,'dropmenu_82954')"><span>Products</span></a></li>
<li><a href="URL" onMouseover="cssdropdown.dropit(this,event,'dropmenu_423082')"><span>Pets</span></a></li>
</ul>
</div>
</div>

<div id="dropmenu_734766" class="dropmenudiv">
<ul>
<li><a href="#"><span>Register</span></a></li>
<li><a href="#"><span>Login</span></a></li>
<li><a href="#"><span>Search</span></a></li>
<li><a href="#"><span>Member List</span></a></li>
<li><a href="#"><span>Latest Posts</span></a></li>
</ul>
</div>

<div id="dropmenu_509055" class="dropmenudiv">
<ul>
<li><a href="#"><span>Register</span></a></li>
<li><a href="#"><span>Login</span></a></li>
<li><a href="#"><span>Search</span></a></li>
<li><a href="#"><span>Our latest</span></a></li>
</ul>
</div>

<div id="dropmenu_82954" class="dropmenudiv">
<ul>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
<li><a href="#"><span>Product here</span></a></li>
</ul>
</div>

<div id="dropmenu_423082" class="dropmenudiv">
<ul>
<li><a href="#"><span>Menu</span></a></li>
<li><a href="#"><span>Menu</span></a></li>
<li><a href="#"><span>Menu here</span></a></li>
<li><a href="#"><span>Menu here</span></a></li>
</ul>
</div>



In case it's needed the chrome.js file:



//Chrome Drop Down Menu- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: June 14th, 06' v2.0

var cssdropdown={
disappeardelay: 200, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: false, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

swipeeffect:function(){
if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
}
else
return
this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure) //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden" //hide menu
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(e){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e)
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
}
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'",this.disappeardelay) //hide menu
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},

startchrome:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel")){
var relvalue=menuitems[i].getAttribute("rel")
menuitems[i].onmouseover=function(e){
var event=typeof e!="undefined"? e : window.event
cssdropdown.dropit(this,event,this.getAttribute("rel"))
}
}
}
}
}

}


Thanks!:)

VIPStephan
Mar 26th, 2009, 05:16 PM
You mean you’re looking for something like this: http://leigeber.com/2008/04/sliding-javascript-dropdown-menu/ ?

patchkinz
Mar 26th, 2009, 05:33 PM
You mean you’re looking for something like this: http://leigeber.com/2008/04/sliding-javascript-dropdown-menu/ ?

Yeah that accomplishes my goal for the dropdown! :)

Thank you very much!

patchkinz
Mar 26th, 2009, 05:34 PM
Now I just need a solution for the sub menu on the sub menu!

Thanks for the help everyone!