如何使悬停效果改变另一个“对象”选中

How to make a hover effect change another "object" selected

本文关键字:对象 选中 另一个 改变 何使 悬停      更新时间:2023-09-26

例如,我有两个类AB,当我将鼠标悬停在数量,颜色等变化时,我需要它们。B.我不知道我是否可以使用CSS和onmouseover

我放了一段代码来处理表的创建和类C的定义。我这里需要的是,当用户选择或悬停在表上时,激活这个类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,
                        },

我相信你需要使用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,我相信这与您正在寻找的类似。

伙计们,我决定如下。我声明了mouseentermouseleave函数,因为只有hover设置了颜色,而没有恢复正常。当您将鼠标放置在表上时,行选择将在类C中发生。

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