2014-07-03 64 views
0

例如,我有兩個類AB,我需要當我將鼠標懸停在數量,顏色等的變化上。B.我不知道是否我可以使用CSS和onmouseover來做到這一點。如何使懸停效果改變選擇另一個「對象」

我把一段代碼,處理表的創建和類C的定義。 我需要在這裏的是,當用戶delecione或將鼠標懸停在表激活此類C

jQuery(grid_selector).jqGrid({ 
     url:urllst, 
     datatype: 'json', 
     height: 'auto',, 
     ignoreCase: true, 
     colNames:['UF','NAME','CITY' ], 
     colModel:[ 
     {name:"uf",index:"uf", width:100, sorttype:'text', viewable: true, frozen: true, focus: true, 
     stype:'text', 
     formoptions:{elmprefix:'*', label: 'UF:', rowpos:1, colpos:1}, 
     editable:true, 
     editrules: {required: true}, 
     edittype: 'custom', 
     classes: 'c', 
     editoptions: {style: "text-transform: uppercase", 
         'custom_element' : macro_uf_element, 
         'custom_value' : macro_uf_value, 

         }, 

回答

0

海伊們,我解決如下。 我宣佈功能mouseentermouseleave,因爲只有hover設置顏色,而不是恢復正常。 將鼠標放在表格行上時,選擇將發生在類C中。

$("#tabDados").mouseenter(function(){ 
    $(".c").css("background-color","#eff3f8"); 
    }); 

$("#tabDados").mouseleave(function(){ 
    $(".c").css("background-color","#fff"); 
    }); 
+0

'Hover'允許兩個回調。您也可以執行'$(「#tabDados」)。hover(callback1,callback2)'第一個回調函數是mouseenter,第二個回調函數是mouseleave。 – Smeegs

0

我相信你需要使用JavaScript,但我可能是錯的。

//grab all of the item images and make sure their popup description shows 
var $contentWrapper = $("#contentWrapper"); 
//and bind the events that allow us to have a popup window follow the cursor 
$contentWrapper.on("mouseover", className, function(event) { 
    var $itemDescription = $(this).parent("").find(".description"); 
    //when the users cursor enters the item ensure that it enables vision of the popup and initialize the coordinates 
    updatePosition(event.clientX, event.clientY, $itemDescription); 
    $itemDescription.show(); 
}); 

這是代碼我使用的顯示,當用戶將鼠標懸停在圖像的DIV一個小片段,我相信這是類似於你在找什麼。

+0

沒有人,這是行不通的,我也試過, 例如,但也不起作用,無論如何感謝您的幫助! – user3775315

+0

你可以提供你的代碼嗎?我會盡我所能幫助UT。我可以向你保證上面的代碼有效,因爲我使用它嘿嘿 – Null

+0

我添加了一部分代碼, – user3775315