Jquery sortable:如何更改被拖动行的字体大小

Jquery sortable: How to change font-size for the row that was dragged

<table>
   <thead>
     <tr>
      <th nowrap align="left" >Sort</th>
      <th nowrap align="left" >User</th>
     </tr>
   </thead>
   <tbody id="sort">
     <tr>
      <td>1</td>
      <td>Jay</td>
     </tr>
     <tr>
      <td>2</td>
      <td>Mike</td>
     </tr>
     <tr>
      <td>3</td>
      <td>Jenny</td>
     </tr>
     <tr>
      <td>4</td>
      <td>Fiona</td>
     </tr>
   </tbody>
</table>   



$( "#sort" ).sortable({
    stop: function( ) {
      $(this).css('font-size', '20px');
   }
});

我在 table 上使用 Jquery sortable,我想更改最后拖放的行的字体大小,以便用户知道他们刚刚拖动的行,我有上面的 JS,但它正在为 2 行设置 css,似乎是被拖放的行和它后面的行,而不仅仅是被拖放的行掉线了。

我是 JS 的新手,对于为什么会发生这种情况以及如何解决它感到非常困惑。

感谢任何帮助。谢谢

改变你的功能

css 文件

.enlarge {
  font-size: 30px;
}

js文件

$("#sort").sortable({
  stop: function(event, ui) {
    $(this).find("tr").removeClass("enlarge")

    $(ui.item).addClass("enlarge");

  }
});

您只想在拖放时添加和删除字体大小。

http://jsfiddle.net/ayang10/fTXRQ/4/