15 分から 45 分までドラッグして、csstdgreen を持つ john に名前を付けると、john のブロックを黄色にする必要があります。15分から30分にドラッグすると、jaryがcsstdgreenを持っている場合、jaryブロックを黄色にする必要があります。私は15分にドラッグし、csstdgreenを持っているジャックをドラッグし、次にジャックブロックを黄色にします。一度に1つだけ.jqueryでそれを行うにはどうすればよいですか
ここで例を示しました。このようにする必要があります。デモを参照してください
$(".csstdgreen").live('mousedown', function (e)
{
//This line gets the index of the first clicked row.
lastRow = $(this).closest("tr")[0].rowIndex;
$(this).removeClass("csstdgreen").addClass("csstdyellow");
e.preventDefault();
return false;
});
$(document).live('mouseup', function () { flag = false; });
$(".csstdgreen").live('mouseenter', function (e)
{
// Compares with the last and next row index.
currentRow = $(this).closest("tr")[0].rowIndex;
if (lastRow == currentRow || lastRow == currentRow - 1 || lastRow == currentRow + 1)
{
lastRow = $(this).closest("tr")[0].rowIndex;
} else
return;
if (flag)
{
$(this).children(":not(:first)").addClass("csstdyellow");
e.preventDefault();
flag = false;
}
});