hey guys - first post - hoping you can help. I’m trying to show and hide a div - i’d like an arrow that when clicked rotates 90 degrees to point down. and while i have the show hide working, it’s
a) not pointing to the right
b) not rotating when clicked
c) I’d like the checkbox to be an image or an icon
d) I’m really trying to avoid the use of JavaScript bc it continues to give me a conflict in Avada
e) I have to use the div class category_filter_box categoryfilter asp_sett_scroll because that is the class of the div I hope to hide uses that class
any chance one of you rock stars have ever tackled this type of css event?
I’d be CRAZY grateful for some insight here.
<!DOCTYPE html>
<html>
<head>
<title>CSS Toggle</title>
<style>
/* Initially hide the div */
.category_filter_box.categoryfilter.asp_sett_scroll {
display: none; /* or visibility: hidden; */
/* Add any other styling you want for the div */
border: 0px solid #ccc;
padding: 10px;
margin-top: 10px;
/* Example for scrolling if content is too large */
max-height: 200px; /* Adjust as needed */
overflow-y: auto;
}
/* Style the button (optional) */
button {
padding: 10px 20px;
background-color: #4CAF50; /* Green */
border: none;
color: white;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
border-radius: 30px;
}
</style>
</head>
<body>
<button id="filter-toggle">FILTERS</button>
<div class="category_filter_box categoryfilter asp_sett_scroll">
<p>Filter options:</p>
<p>SOME COPY WILL BE HERE THAT IS TIED TO THE TOGGLE BUTTON</p>
</div>
<script>
const toggleButton = document.getElementById('filter-toggle');
const filterDiv = document.querySelector('.category_filter_box.categoryfilter.asp_sett_scroll');
toggleButton.addEventListener('click', () => {
if (filterDiv.style.display === 'none') {
filterDiv.style.display = 'block'; // Or filterDiv.style.visibility = 'visible';
toggleButton.textContent = 'FILTERS';
} else {
filterDiv.style.display = 'none'; // Or filterDiv.style.visibility = 'hidden';
toggleButton.textContent = 'FILTERS';
}
});
</script>
</body>
</html>