Click Entire Row (preserving middle click and ctrl+click)

后端 未结 10 1191
独厮守ぢ
独厮守ぢ 2020-12-07 20:49

I have an HTML table with a link in the first column. I want to allow the user to click anywhere in the row to activate that link. At the same time, I would like to preser

10条回答
  •  轮回少年
    2020-12-07 21:28

    You can make a link and let it floting around in your tr, biding to mouveover event, update href and position

    create one pixel link

    ....
    
    

    update href and position on mouse over

    $("#row_link tr").mouseover(
       function(event){
          //update href
          $("#onepixel").attr("href",$(this).find("a:first").attr("href"));
          //update position, just move to current mouse position
          $("#onepixel").css("top",event.pageY).css("left",event.pageX);
       }
    );
    

提交回复
热议问题