2012-01-17 109 views
0

我有一个下拉菜单与CSS文件,我想将其转换为Verctical菜单我尝试了很多,但我可以做,请任何人都帮我Folowing是我的CSS和HTML code.anyone请告诉我正是我缺少的是由于其菜单没有转换转换下拉菜单到垂直

#sddmT 
{ margin: 0; 
    padding: 0; 
    z-index: 30} 

#sddmT li 
{ margin: 0; 
    padding: 0; 
    list-style: none; 
    float: left; 
    font: bold 11px arial} 

#sddmT li a 
{ display: block; 
    margin: 0 1px 0 0; 
    padding: 4px 10px; 
    width: 60px; 
    background: #4A617B; 
    color: White; 
    text-align: center; 
    text-decoration: none} 

#sddmT li a:hover 
{ background: #BDCFD6; 
    color:#4A617B 

    } 

#sddmT div 
{ position: absolute; 
    visibility: hidden; 
    margin: 0; 
    padding: 0; 
    background: #4A617B; 
    border: 1px solid #BDCFD6} 

    #sddmT div a 
    { position: relative; 
     display: block; 
     margin: 0; 
     padding: 5px 10px; 
     width: auto; 
     white-space: nowrap; 
     text-align: left; 
     text-decoration: none; 
     background: #4A617B; 
     color: #BDCFD6; 
     font: 11px arial} 

    #sddmT div a:hover 
    { background: #BDCFD6; 
     color: #4A617B} 

而且她是HTML代码

<ul id="sddm"> 
    <li><a href="#" onmouseover="mopen('m1')" onmouseout="mclosetime()">ETP</a> 
     <div id="m1" onmouseover="mcancelclosetime()" onclick="mclosetime()"> 
     <a href="http://dashboard.shakarganj.com.pk/ca/sml1etp.php" target=_blank>ETP - Jhang</a> 
     <a href="http://dashboard.shakarganj.com.pk/ca/sml2etp.php" target=_blank>ETP - Bhone</a> 
     </div> 
     </li> 
    </ul> 

这里是我的JS代码CLOS并打开菜单项

<!-- 
var timeout   = 500; 
var closetimer  = 0; 
var ddmenuitem  = 0; 

// open hidden layer 
function mopen(id) 
{ 
    // cancel close timer 
    mcancelclosetime(); 

    // close old layer 
    if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; 

    // get new layer and show it 
    ddmenuitem = document.getElementById(id); 
    ddmenuitem.style.visibility = 'visible'; 

} 
// close showed layer 
function mclose() 
{ 
    if(ddmenuitem) ddmenuitem.style.visibility = 'visible'; 
} 

// go close timer 
function mclosetime() 
{ 
    closetimer = window.setTimeout(mclose, timeout); 
} 

// cancel close timer 
function mcancelclosetime() 
{ 
    if(closetimer) 
    { 
     window.clearTimeout(closetimer); 
     closetimer = null; 
    } 
} 

// close layer when click-out 
//document.onclick = mclose; 
// --> 

更新 我想这样 enter image description here

+0

任何一个请回答我的问题 – 2012-01-17 06:59:44

+0

你想要这个:http://jsfiddle.net/Z8jpD/1 – diEcho 2012-01-17 07:03:22

+1

请问你能描述一下垂直菜单的样子吗? – 2012-01-17 07:07:18

回答

0

试试这个:

#sddmT李{保证金:0; 填充:0; list-style:none; position:static; font:bold 11px arial; }

+0

请参阅我的更新 – 2012-01-17 07:20:12

+0

那么,你现在在哪里 – 2012-01-17 07:33:50

0

我知道这是一个旧帖子,但我不禁注意到你的主菜单和子菜单之间有一些空格。用他们指向的项目包装子菜单将工作,但您需要消除空白,或者每次打开菜单时都会触发关闭/退出功能。

margin: 0 1px 0 0 vs margin:0