2012-05-09 121 views
0

這是我的頁面的HTML部分:懸停在DIV不工作

<div class="edenKomentar"> 
      <div class="rejtingVoKomentar" onmouseover="alert('asd');"> 
       <div class="thumbUp"> </div> 
       <div class="thumbDown"> </div> 
      </div> 
      <div class="imeVoKomentar">Name</div> 
      <div class="tekstVoKomentar">Comment</div> 
      <div class="datumVoKomentar">Date</div> 
    </div> 

,這是我的CSS代碼:

div.edenKomentar:hover { 
// border-bottom: dashed 1px gray; 
    border-left: solid 8px #003366; 
} 
div.edenKomentar:hover div.imeVoKomentar { 
    color:#003366; 
} 

.edenKomentar div.rejtingVoKomentar { 
    position: absolute; 
    overflow:hidden; 
    right:5px; 
    top:15px; 
    height:35px; 
    width: 100px; 
    padding: 5px; 
    border: solid 1px green; 
} 

.edenKomentar div.rejtingVoKomentar:hover{ 
    border: solid 2px green; 
    background-color:#66FF00; 
} 


.rejtingVoKomentar .thumbUp,.thumbDown { 
    position: relative ; 
    height: 25px; 
    width: 25px; 
    border: solid 1px red; 
    top: 10px; 
} 
.rejtingVoKomentar .thumbDown { 
    right: 5px; 
    background:url(sliki/Ikoni/Thumb-down-icon.png); 
    background-repeat:no-repeat; 
} 
.rejtingVoKomentar .thumbUp { 
    left: 5px; 
    background:url(sliki/Ikoni/Thumb-up-icon.png); 
    background-repeat:no-repeat; 
} 
.rejtingVoKomentar .thumbDown:hover{ 
    border: solid 2px red; 
} 

的問題是,懸停(和的onmouseover)上.rejtingVoKomentar (和.thumbUp和.thumbDown也)不工作時.rejtingVoKomentar

position:absolute; 

屬性。這裏有什麼問題?

+0

剛剛創建了一個[jsfiddle with your code](http://jsfiddle.net/libinvbabu/cQ57w/)。現在解釋那裏有什麼問題。 – Libin

回答

0

你會使用jQuery激活DIV

懸停,或只是想通過CSS使用它只是你需要使用UL,李代替

UPDATE1

檢查在這個鏈接SO Jquery Div Hover change other Div Class

+0

jQuery也不工作,這裏是一個鏈接到頁面,只是嘗試禁用位置:絕對; on.rejtngVoKomentar和.thumbUp及其所有工作都沒關係。鏈接 - [鏈接](http://ipproekt.x10.mx/Komentari.html) – korun

+0

檢查update11中的新鏈接,Regards – Mhmd

+0

我設法通過更改z-index來完成它,現在我可以用它CSS和jQuery。謝謝大家 – korun

0
.headermenu li a{ 
    text-align:center; 
    padding:0px 0 0 12px; 
    margin-left:20px; 
    display:block; 
    color: #ccc; 
    text-decoration:none; 
    font-size:12px; 
    float:right; 
    background:url(../images/arrow.png) no-repeat left center; 
} 

.headermenu li a:hover{ 
    text-align:center; 
    display:block; 
    color: #0066CC; 
    text-decoration:none; 
    float:right; 
    background:url(../images/arrow_hover.png) no-repeat left center; 
} 
0

您可以使用此短jQuery代碼:

$(document).ready(function() { 
$(".rejtingVoKomentar").hover(
    function() { 
    //On mouseOver 
    alert('asd'); 
    }, 
    function() { 
    //On mouseOut 
    } 
);});