Using JavaScript to change CSS visibility is trivial
element.style.visibility = 'visible'
element.style.display = 'block'
but, is it possible to go the other way, that is, trigger JS when CSS visibility changes? For example
#element {
visibility: hidden;
display: none;
}
#element::target {
visibility: visible;
display: block;
}
When a user clicks on element, I want aFunction() to fire with access to info about the element's DOM properties. I am assuming that is not possible but asking just in case…
MutationObserverquestion. It almost (but not quite) does what I want but, on the other hand, I learned something new :) @a-haworth I was not using a click even but instead using the CSS pseudoclass:targetto change visibility, and wanted to fire a function when the visibility changed. Anyway, have decided to implement a different approach. Thanks all. Am closing the question.