Hello I am a newbie in javascript and jquery. I have this button on my page that toggles a nav when pressed. When toggled, only content shows which is below the nav in the same html page. This works great for what I need. But I would like the same button, when showing the navigation to hide the content. Is it possible? Here is the code:
if (window.innerWidth && window.innerWidth <= 480) {
$(document).ready(function(){
$('#header ul').addClass('hide');
$('#content').addClass('show');
$('#header').append('<div class="rightButton" onclick="toggleMenu()">Menu</div>');
});
function toggleMenu() {
$('#header ul').toggleClass('hide');
$('#header .rightButton').toggleClass('pressed');
if(pressed) {
$('#content').toggleClass('hide'); }
}
}
I would greatly appreciate help!












