I'm looking to cycle between 5 or 6 currencies and only want to be able to display one currency at any given time. I can't use input tags (no :checked pseudoclass) and :target due to platform restrictions (I'm working within a rich text widget that can't navigate to a fragment identifier).
Supported HTML tags:
"br" "div" "span" "i" "b" "strong" "s" "strike" "u" "em" "blockquote" "tt" "sup" "sub" "small" "mark" "del" "ins" "ul" "ol" "li" "dl" "dt" "dd" "h1" "h2" "h3" "h4" "h5" "h6" "hr" "a"
The fiddle I'm working on: http://jsfiddle.net/nAg7W/803/ I'm hoping to have the HKD currency remain on the screen after clicking on the HKD link and then clicking elsewhere.
I've tried to toggle using the display: none; / display: block; properties, but found out from trial & error + this thread (Transitions on the display: property) that it won't work. With :focus, as soon as I click another element on the page I revert back to USD.
div p {
transition: opacity 0s;
display: block;
overflow: hidden;
position: relative
}
div p#usd {
opacity: 1;
height: auto;
}
div p#hkd {
opacity: 0;
height: 0;
}
#hkd-toggle:focus ~ #hkd {
opacity: 1;
height: auto;
position: absolute;
}
#hkd-toggle:focus ~ #usd {
opacity: 0;
height: 0;
position: absolute
}
<div>
<ul style="list-style-type: none;">
<li>
<a href="#" id="usd-toggle">USD</a>
<a href="#" id="hkd-toggle">HKD</a>
<p id="usd">suhh</p>
<p id="hkd">duuude</p>
</li>
</ul>
</div>
Any ideas on how to achieve this with purely CSS? I was hoping there could be a delay on persisting the focus state but it seems to be a dead end. Any help would be very much appreciated.
Thanks!