I have a bit of trouble as i do not really use jquery a lot neither do i have a lot of experience with javascript but i found a good working menu that looks pretty good:
jQuery(window).load(function() {
$("#nav > li > a").click(function (e) {
if ($(this).parent().hasClass('selected')) {
$("#nav .selected div div").slideUp(100);
$("#nav .selected").removeClass("selected");
} else {
$("#nav .selected div div").slideUp(100);
$("#nav .selected").removeClass("selected");
if ($(this).next(".subs").length) {
$(this).parent().addClass("selected");
$(this).next(".subs").children().slideDown(200);
}
}
e.stopPropagation();
});
$("body").click(function () {
$("#nav .selected div div").slideUp(100);
$("#nav .selected").removeClass("selected");
});
});
The menu is as simple as this:
<li><a href="#">Tutorials</a>
<div class="subs">
<div>
<ul>
<li><h3>Submenu #1</h3>
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
<li><a href="#">Link 4</a></li>
<li><a href="#">Link 5</a></li>
</ul>
</li>
<li><h3>Submenu #2</h3>
<ul>
<li><a href="#">Link 6</a></li>
<li><a href="#">Link 7</a></li>
<li><a href="#">Link 8</a></li>
</ul>
</li>
<li><h3>Submenu #3</h3>
<ul>
<li><a href="#">Link 9</a></li>
<li><a href="#">Link 10</a></li>
</ul>
</li>
</ul>
</div>
</div>
</li>
What i added is a simple login tab that expands and shows you the username and password input but with the current jquery it unselects the parent and it slides back up when i select the input fields.
My question is what do i need to add (or remove) to stop it from sliding up when i press the input fields (and submit button)
Help is much appreciated, Cheers!
formelements are part of the dropdown? Maybe children of thelis?<li><a href="#">Link 9</a></li>becomes<input type="text" placeholder="Username" id="username" />