I have a menu and my users should be able to resize it by pressing a button. I have the following code:
<header class='large'>
<nav>
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
</nav>
</header>
<button onclick="resizeMenu()">Resize</button>
function resizeMenu()
{
if(exists(header.large) {
$("header").removeClass("large").addClass("small");
} elseif(exists(header.small)
$("header").removeClass("small").addClass("large");
}
}
I don't really have an idea on how I should write the condition. By the way I am using jquery.