I have a piece of code that works, but not exactly as I want it to. What I would like is to create a menu bar where, upon hovering over an item, the options slide out from underneath, without pushing the other menu items down.
If this description isn't clear, feel free to copy the code below:
$(document).ready(function () {
$('.selector').mouseenter(function () {
$(this).find('> ul').slideToggle('fast');
});
$('.selector').mouseleave(function () {
$(this).find('> ul').slideToggle('fast');
});
});
* {
border: 1px solid black;
}
body {
width: 98%;
}
#title {
text-align: center;
font-size: 250%;
}
#menu_Bar {
margin: 0.01%;
}
.sel_name {
font-size: 70%;
text-align: center;
}
.empty {
list-style: none;
}
.options {
display: none;
background-color: lightblue;
}
.selector {
background-color: transparent;
display: inline-block;
width: 19%;
}
<h1 id='title'>Welcome to My Site</h1>
<div id='menu_Bar'>
<div class='selector'>
<p class='sel_name'>Home
<p>
<ul style='display: none' class='empty'>
<li><a href=''>option 1</a></li>
<li><a href=''>option 2</a></li>
<li><a href=''>option 3</a></li>
<li><a href=''>option 4</a></li>
<li><a href=''>option 5</a></li>
</ul>
</div>
<div class='selector'>
<p class='sel_name'>Shows
<p>
<ul style='display: none' class='empty'>
<li><a href=''>option 1</a></li>
<li><a href=''>option 2</a></li>
<li><a href=''>option 3</a></li>
<li><a href=''>option 4</a></li>
<li><a href=''>option 5</a></li>
</ul>
</div>
<div class='selector'>
<p class='sel_name'>Search
<p>
<ul style='display: none' class='empty'>
<li><a href=''>option 1</a></li>
<li><a href=''>option 2</a></li>
<li><a href=''>option 3</a></li>
<li><a href=''>option 4</a></li>
<li><a href=''>option 5</a></li>
</ul>
</div>
<div class='selector'>
<p class='sel_name'>About the Owner
<p>
<ul style='display: none' class='empty'>
<li><a href=''>option 1</a></li>
<li><a href=''>option 2</a></li>
<li><a href=''>option 3</a></li>
<li><a href=''>option 4</a></li>
<li><a href=''>option 5</a></li>
</ul>
</div>
<div class='selector'>
<p class='sel_name'>FAQ
<p>
<ul style='display: none' class='empty'>
<li><a href=''>option 1</a></li>
<li><a href=''>option 2</a></li>
<li><a href=''>option 3</a></li>
<li><a href=''>option 4</a></li>
<li><a href=''>option 5</a></li>
</ul>
</div>
</div>