質問編集履歴
1
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,3 +38,21 @@
|
|
38
38
|
</body>
|
39
39
|
```
|
40
40
|
|
41
|
+
ちなみに、iframeには以下jsファイルを入れて、マウスカーソルが↑にあるセルの色を変えております。
|
42
|
+
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
|
43
|
+
|
44
|
+
```iframe.js
|
45
|
+
$(function() {
|
46
|
+
$('.matrix').find('th, td').on('mouseenter', function() {
|
47
|
+
// マウスカーソルがのっているセルが左から何番目かを取得
|
48
|
+
var idx = $(this).parent().find('th, td').index(this);
|
49
|
+
if (idx <= 0) return;
|
50
|
+
var s = '.matrix tr > *:nth-of-type(' +(idx+1)+ ')';
|
51
|
+
$(s).addClass('cursor');
|
52
|
+
})
|
53
|
+
.on('mouseleave', function() {
|
54
|
+
// Classを全て削除
|
55
|
+
$('.matrix *.cursor').removeClass('cursor');
|
56
|
+
});
|
57
|
+
});
|
58
|
+
```
|