この関数を使用して、カーソルが通過したときに行に表示された 2 つのテーブルから各行のホバーとフォーカスを行い、各 tr のクリックにフォーカスします。正常に動作しますが、速度が低下しているため、IE に問題があり、その理由がわかりません。この関数のパフォーマンスを向上させる方法を誰か教えてもらえますか?
実際の例を確認してください: http://mainpage.ueuo.com/
function rowSelection(){
var rows = $('.interactive tr');
rows.click(function () {
var i = $(this).GetIndex() + 1; // nth-child is 1-based
rows.removeClass('selectedRow');
rows.filter(':nth-child(' + i + ')').addClass('selectedRow');
});
rows.hover(function(){
var i = $(this).GetIndex() + 1;
rows.filter(':nth-child(' + i + ')').addClass('hoverx');
},function(){
rows.removeClass('hoverx');
});
};
jQuery.fn.GetIndex = function(){
return $(this).parent().children().index($(this));
}
ありがとうございました。