How can I click this pseudo element :after
? I used CSS to make an overlay, I guess is quite clever but I have to click it in order to close the overlay (:after
).
JavaScript
if($('.open-sidebar').is(':visible')){
$('.navigation-wrap').attr('menu-overlay').bind('click', function(){
$(this).removeClass('open-sidebar');
});
}
CSS
&:after {
content: attr(menu-overlay);
position:absolute;
top:0;
bottom:0;
left: 0;
right:0;
width: 100%;
height: 100%;
background: rgba(6, 16, 35, 0);
z-index: -1;
cursor: pointer;
}