I am working on a glossary of words, with explanatory texts made invisible behind keywords, made invisible with {visibility:hidden; opacity:0;}
but I noticed keywords are hidden from Find in any browser.
I also learned that hidden text is no good to html-readers, so the disabled cannot use this glossary. So users can not Search and Find and the blind can have no profit of it. All in all, no good.
So what I want to make: the same keyword div
, the explanatory text aside in a very small font-size with the same color as the background, with overflow:hidden
and when I click on that keyword the (a moment before) unreadable text popup in all glory. But I do not like to have the explanatory texts twice, i.e. one time hidden and one time ready for the popup.
How to do that?
So with a click on the keyword, the attributes of the class change, from one class to another? Can that be done?
Here is an example of one entry I have (class x is used to close popup):
CSS:
.w { font-size: .75em;
line-height:1.2em;
height:27px;
background-color:#f2f3f4;
margin-right:2px;
margin-bottom:6px;
outline:0px;
cursor:pointer;
padding:7px;
width:170px;
display:inline-block;
vertical-align: middle;
text-align:left;
border: .5px solid #f2f3f4;
}
.ov {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.6);
transition: opacity 1000ms;
visibility: hidden;
opacity: 0;
}
.ov:target {
visibility:visible;
opacity: 1;
}
.tt {
position:absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 33px;
padding-left:40px;
background: #fff;
border-radius: 10px;
width: 70%;
height:auto;
max-height:80%;
transition: all 1s ease-in-out;
font-family: "basr";
font-size:.85em;
line-height:1.5em;
text-align:left;
outline:0px;
overflow:auto;
}
.x {
cursor:pointer;
position: absolute;
top: 8px;
right: 13px;
font-size: 15px;
font-family:"arial";
text-decoration: none;
}
p3 {
font-family:"chunk";
font-size:2em;
color:#c33;
margin-right:.5em;
margin-left:-.5em;
vertical-align:4px;
line-height:1.4em;
}
HTML:
<a class=w href=#232>
Ahti</a><div class=ov id=232><div class=tt><a class=x href=#>
×</a><p3>
Ahti</p3>
(Fins) De Finse god van het water, afgebeeld als een oude man en hulp van de vissers; zijn vrouw heet Vellamo. Ook een naam van Lemminkaïnen, die de draak van kennis wordt genoemd in de Kalevala.</div></div>