[英]Highlighting row and column in a table
I want to highlight row and column in a table but not all of them, just until end of selected one td. 我要突出显示表中的行和列,但不是全部都突出显示,直到选中的一个td结束。 I'll put a link here to prove what i want, go down and where is size table (size chart) hover on it and you will see:
我将在此处放置一个链接以证明我想要的内容,向下浏览一下,尺寸表(尺寸表)悬停在哪里,您将看到:
http://www.nike.com/ro/en_gb/c/size-fit-guide/mens-shoe-sizing-chart
How can I highlight with limit like that? 我该如何用这样的限制突出显示?
Here is my table: https://jsfiddle.net/pkkbf9k2/ 这是我的桌子: https : //jsfiddle.net/pkkbf9k2/
I think that's it: https://jsfiddle.net/8odoros/pkkbf9k2/4/ 我认为就是这样: https : //jsfiddle.net/8odoros/pkkbf9k2/4/
$( "td" ).hover(
function() {
var myCol = $(this).index();
var $tr = $(this).closest('tr');
var myRow = $tr.index()+1;
$('tr:nth-child('+myRow+') td:lt('+myCol+')').addClass( "hover" );
myCol++; myRow--;
$('table tbody td:nth-child('+myCol+')').each(function (index) {
if(index<myRow) $(this).addClass( "hover" );
});
$(this).addClass('hoverBold');
}, function() {
$( '*' ).removeClass( "hover" );
$(this).removeClass('hoverBold');
}
);
Here is a similar CSS tutorial. 这是一个类似的CSS教程。 It will give you a more better idea.
它会给你一个更好的主意。
https://css-tricks.com/simple-css-row-column-highlighting/ https://css-tricks.com/simple-css-row-column-highlighting/
Hope this helps you. 希望这对您有所帮助。
You can give the bgcolor to the tag which you wanted to highlight. 您可以将bgcolor赋予要突出显示的标签。
<td bgcolor="#FF0000">Content</td>
Or You can give class also to the tag which you want to highlight. 或者,您也可以给要突出显示的标签添加类。 example
<td class="highlight">Content</td>
and give the background color to the style.css file. 例如
<td class="highlight">Content</td>
然后将背景色赋予style.css文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.