I am trying to make an interactive map with information about this. When you click on a point, it changes and shows some contacts. This is achieved by the fact that the element receives pseudo-classes :activeand :focus.
Is there a way to remove pseudo-classes from an element when it is clicked a second time? In fact, is it possible to close an item when pressed again?
.distribution-map {
position: relative;
width: 100%;
padding: 20px;
box-sizing: border-box;
margin: 0 auto;
}
.distribution-map .map-point {
cursor: pointer;
outline: none;
top: 20px;
position: absolute;
width: 40px;
height: 40px;
border-radius: 20px;
}
.distribution-map .map-point:active,
.distribution-map .map-point:focus {
margin: 0;
padding: 0;
filter: opacity: 1;
width: 300px;
height: 220px;
color: #e5e5e5;
z-index: 1;
-webkit-transition: opacity 0.25s ease-in-out, width 0.25s ease-in-out, height 0.25s ease-in-out;
transition: opacity 0.25s ease-in-out, width 0.25s ease-in-out, height 0.25s ease-in-out;
}
<div class="distribution-map">
<button class="map-point">
</button>
</div>
Run codeHide result
source
share