How to show/hide class :before and :after pseudo elements with JavaScript?
I have arrows on both sides of div. Below is arrows style
.edit-wrap:before,
.edit-wrap:after {
@media (max-width: 768px) {
content: '';
....
}
}
I want to hide them, if, for example, there is no scroll bar in the element. And show otherwise
var scrollableElement = document.getElementById('scrollable-element');
if(scrollableElement.scrollWidth>scrollableElement.clientWidth){
//display arrows
} else{
//hide arrows
}
I am not using JQuery