Fixed furigana style.

This commit is contained in:
doncr 2017-12-26 17:34:46 +00:00
parent 47fa14deea
commit 1d68a32b58
2 changed files with 20 additions and 3 deletions

View File

@ -198,7 +198,6 @@ div.options ul {
transition: all 0.15s ease;
color: #333;
font-size: 12px;
background: yellow;
}
[tooltip]:hover:before {
@ -206,13 +205,31 @@ background: yellow;
opacity: 1;
/* customizable */
margin-top: -20px;
margin-top: -12px;
}
[tooltip]:not([tooltip-persistent]):before {
pointer-events: none;
}
/* Custom positions for furigana */
.tooltip-w1[tooltip]:before { font-size: 8px; margin-left: 4px; }
.tooltip-w2[tooltip]:before { font-size: 8px; margin-left: 0px; }
.tooltip-w3[tooltip]:before { font-size: 8px; margin-left: -4px; }
.tooltip-w1[tooltip]:hover:before,
.tooltip-w2[tooltip]:hover:before,
.tooltip-w3[tooltip]:hover:before { margin-top: -10px; }
#question .tooltip-w1[tooltip]:before { font-size: 12px; margin-left: 14px; }
#question .tooltip-w2[tooltip]:before { font-size: 12px; margin-left: 8px; }
#question .tooltip-w3[tooltip]:before { font-size: 12px; margin-left: 2px; }
#question .tooltip-w1[tooltip]:hover:before,
#question .tooltip-w2[tooltip]:hover:before,
#question .tooltip-w3[tooltip]:hover:before { margin-top: -12px; }
div#explanation p span {
}

View File

@ -226,7 +226,7 @@ function wordWithFurigana(words) {
var bits = word.split(/(.)\[([^\]]*)\]/);
while (bits.length > 1) {
bits[0] = bits[0] + "<span tooltip='" + bits[2] + "'>" + bits[1] + "</span>" + bits[3];
bits[0] = bits[0] + "<span class='tooltip-w" + bits[2].length + "' tooltip='" + bits[2] + "'>" + bits[1] + "</span>" + bits[3];
bits.splice(1, 3);
}