Adding colomat-close class at certain width
-
LOVE this plugin.
I’m displaying the collapse/expand trigger <800px wide as I want my sidebar to appear normal and expanded over 800px. However, I want the sidebar to automatically collapse under 800px, so I tried the following jQuery:
function checkWidth(init) { /*If browser resized, check width again */ if ($(window).width() < 800) { $('#collapse1').removeClass('colomat-close'); } else { if (!init) { $('#collapse1').addClass('colomat-close'); } } }With the following HTML:
<span class="collapseomatic colomat-close" id="collapse1">Filter</span> <span id="swap-collapse1" style="display: none;">Close Filter</span> <div class="collapseomatic_content" id="target-collapse1"> <?php dynamic_sidebar( 'Sidebar' ); ?> </div>But the sidebar just stays expanded even under 800px.
Any ideas?
The topic ‘Adding colomat-close class at certain width’ is closed to new replies.