Provide the ability to get the nav item width of text.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Captain ALM 2022-08-17 13:44:18 +01:00
parent 67dd95be76
commit 6131f1612c
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1
3 changed files with 21 additions and 3 deletions

View File

@ -7,6 +7,14 @@ Under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 Internati
padding: 0;
box-sizing: border-box;
}
#st{
position: absolute;
left: -1080px;
top: -1080px;
font-size: 1em;
visibility: hidden;
white-space: nowrap;
}
main{
padding-top: 70px;
padding-left: 6px;
@ -122,6 +130,8 @@ main{
}
.menu a, .vmenu a{
display: block;
}
.menu a, .vmenu a, #st{
padding: 24px 16px;
}
.vmenu li{
@ -321,9 +331,6 @@ main{
float: right;
width: auto;
}
.vnav{
display: none;
}
.menu li{
float: left;
}

View File

@ -195,5 +195,6 @@
<img src="https://mirrors.creativecommons.org/presskit/buttons/80x15/png/by-nc-nd.png" alt="License" height="16"></a>.
</p>
</footer>
<div id="st"></div>
</body>
</html>

View File

@ -290,4 +290,14 @@ function SortDurationD(a, b) {
} else {
return 1
}
}
function GetNavTextWidth(s) {
var st = document.getElementById("st");
if (st) {
st.textContent = s
var trw = st.clientWidth;
st.textContent = ""
return trw;
}
return 8 * s.length + 32
}