2014-01-19 5 views
1

드롭 다운 메뉴의 "FS1"목록 텍스트 위에 마우스를 가져 가면 "OL" "하위 목록"을 표시하려고합니다. 여기에 내가하려고하는 것에 대한 데모가 있습니다 :목록 위로 마우스를 가져 가면 텍스트가 표시됩니다.

누군가가 "UL" "List"의 텍스트 위에 마우스를 가져 가면 "OL" "Sublist"를 어떻게 보이게 할 수 있습니까? ?

코드의 조각

난은 IS 찾고 :

CSS :

.wrap .sublist {text-decoration: none; list-style: none; font-family: Arial, Helvetica, sans-serif; font-size: 20px; 
        visibility: hidden; position: absolute; top: 0.8em; left: 3.8em; z-index: 600; font-weight: lighter; color: #222;} 
     .wrap .sublist a {color: #06C; position: absolute; top: 3em; font-weight: bold; font-size: 13px;} 
     .fs1:hover .wrap {visibility: visible;} 

HTML :

<ol class="sublist"> 
    <li>FS (All)</li> 
    <li><a href="">FS</a></li> 
</ol> 
<ul class="list"> 
    <li class="fs1"><a href="">FS1</a></li> 
    <li id="c1"><a href="">C1</a></li> 
    <li id="wt1"><a href="">WT1</a></li> 
    <li id="a1"><a href="">A1</a></li> 
</ul> 
+0

솔루션 : http://stackoverflow.com/questions/11587407/displaying- 메뉴 - 온 - 호버 - 오버 - 인 - 인 -리스트 (item-in-list)? rq = 1 –

답변

0

자바 스크립트를 사용할 수 있습니다! 예를 들어
는 :

<script language="Javascript> 
function appear() { 
document.getElementById("sublist").style.display = "block"; 
} 
function hide() { 
document.getElementById("sublist").style.display = "none"; 
} 
</script> 

<ol class="sublist" id="sublist"> 
... 
</ol> 
<ul class"list"> 
<li class="fs1" onmouseover="appear()" onmouseout="hide()"><a href="">FS1</li> 
... 
</ul> 
+0

예, 아마 최선의 선택이 될 것입니다. 나는 JS 피들에 코드를 함께 넣었다 : http://jsfiddle.net/EfLJJ/8/. 하지만 작동하지 않습니까? 저에게 데모를 보내 주시겠습니까? – fudgematico

+0

죄송합니다, 나는 현기증 나는 코드를 만들었습니다 ;-) 필자는 지금 피들을 http://jsfiddle.net/EfLJJ/11/으로 업데이트했으며 JS 피들에서 왜 그렇게 작동하지 않는지 궁금합니다. 내 localhost가 완벽하게 실행됩니다 ... – SaschaP

0

는이 같은 뭔가를 찾고 계십니까?

<style> 
.sublist {text-decoration: none; list-style: none; font-family: Arial, Helvetica, sans-serif; font-size: 20px; 
        display:none; position: absolute; top: 0.8em; left: 3.8em; z-index: 600; font-weight: lighter; color: #222;} 
     .wrap .sublist a {color: #06C; position: absolute; top: 3em; font-weight: bold; font-size: 13px;} 
     .fs1:hover .wrap {visibility: visible;} 
.su 
</style> 
<script> 
function show() 
{ 
document.getElementById("sublist").style.display="block"; 
} 
</script> 
<ol class="sublist" id="sublist"> 
    <li>FS (All)</li> 
    <li><a href="">FS</a></li> 
</ol> 
<ul class="list"> 
    <li class="fs1"><a href="" onmouseover="show();">FS1</a></li> 
    <li id="c1"><a href="">C1</a></li> 
    <li id="wt1"><a href="">WT1</a></li> 
    <li id="a1"><a href="">A1</a></li></div> 
</ul> 
0

.sublist를 전환 .fs1mouseentermouseleave 이벤트에 대한 eventhandlers을 연결합니다. 초기에 .sublist을 숨기려면 display:none을 사용하는 것이 중요합니다.

자바 스크립트

$(".list .fs1").bind({ 
    mouseenter:function(){ 
     $(".sublist").show(); 
    }, 
    mouseleave: function(){ 
     $(".sublist").hide(); 
    } 
}); 

CSS

.wrap .sublist { 
    text-decoration: none; 
    list-style: none; 
    font-family: Arial, Helvetica, sans-serif; 
    font-size: 20px; 
    display:none; 
    position: absolute; 
    top: 0.8em; 
    left: 3.8em; 
    z-index: 600; 
    font-weight: lighter; 
    color: #222; 
} 

JS 바이올린 : 여기http://jsfiddle.net/EfLJJ/2/

+0

업데이트 주셔서 감사합니다 jsfiddle에서 작동하지만 Dreamweaver에서 작동하지 않니? – fudgematico

관련 문제