2013-04-15 86 views

回答

1

使用jQuery UI的選擇和類似下面的代碼:

$("#yourTable").selectable(
    { 
    distance: 10, 
    stop: function() 
    { 
     $(this).find("tr").each(
     function() { 
      if ($(this).hasClass('ui-selected')) 
      $(this).addClass('row-selected'); 
      else 
      $(this).removeClass('row-selected'); 
     }); 
    } 
    }); 

我使用「距離:10」,因爲我發現我的,否則對錶的mousedown處理程序將無法獲得事件 - 這可能不是對你很重要。

相關問題