I am dealing with a situation on my website where I need to hide a sidebar when clicked.
$('#sidebar').toggle('slide', 'left', 300)
In addition, I have implemented a CSS style to hide the sidebar on mobile devices.
#sidebar {
display: none;
}
/* if screen size gets wider than 768 */
@media screen and (min-width:768px) {
#sidebar {
display: block;
}
}
Unfortunately, these two methods are not working well together because .toggle()
uses inline CSS. Is there a way to make .toggle()
apply an inline style? Or perhaps there is a more effective solution to this problem?
Thank you! Thomas