Creating different layouts for different devices (or screen sizes) can be done through media queries.
Go to your theme editor and open your theme.css or base.css file.
And add the following code:
.footer-links {
display: flex;
justify-content: space-between;
}
.footer-section {
width: 30%;
}
@media only screen and (max-width: 768px) {
.footer-links {
display: flex;
flex-direction: column;
padding: 20px;
}
.footer-section {
width: 100%;
margin-bottom: 20px;
text-align: left;
}
.dropdown-content {
display: none;
padding-left: 15px;
}
.footer-section.active .dropdown-content {
display: block;
}
.footer-section h4 {
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
}
.dropdown-indicator {
margin-left: 10px;
}
.footer-section ul {
list-style-type: none;
padding: 0;
margin: 0;
}
.footer-section ul li a {
text-decoration: none;
color: inherit;
}
}
Create a new Javacsript file and add the following code:
const dropdowns = document.querySelectorAll(‘.dropdown-toggle’);
dropdowns.forEach(dropdown => {
dropdown.addEventListener(‘click’, function() {
dropdowns.forEach(otherDropdown => {
if (otherDropdown !== this) {
otherDropdown.parentElement.classList.remove(‘active’);
}
});
this.parentElement.classList.toggle(‘active’);
});
});