1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$(function(){
	$('td').each(function(i){
		var $this = $(this),
			$row = $this.parent('tr'),
			$table = $this.parents('table'),
			index = (i%($row.children('td').length)) + 1;
		
		$this.hover(function(){
			$row.addClass('rowHover');
			$('td:nth-child(' + index + ')', $table).addClass('columnHover');
			$this.addClass('hover');
		}, function(){
			$row.removeClass('rowHover');
			$('td:nth-child(' + index + ')', $table).removeClass('columnHover');
			$this.removeClass('hover');
		});
	});
});