I got this menu I've been working on, I want to make an outside div appear when I mouseover the a.
I've searched through all stackoverlow but all those solutions can't seem to work for me. I must be doing something wrong. I would appreciate some help with this.
my html
<div id="hover1"></div>
<div style="float: left; position: relative; left: 50%; margin-top: 237px;">
<img src="img/octo_logo.png" class="logo" />
</div>
<!-- MENU start -->
<div id="menu">
<ul>
<li><a href="bio.html"><span>BIO</span></a></li>
<li><a href="equipa.html"><span>EQUIPA</span></a></li>
<li><a href="reconhecimento.html"><span>RECONHECIMENTO</span></a></li>
<li><a href="parceiros.html"><span>PARCEIROS</span></a></li>
<li><a href="porque_nao.html"><span>PORQUE NÃO?</span></a></li>
<li><a href="contactos.html"><span>CONTACTOS</span></a></li>
</ul>
</div>
my css:
#hover1{
width: 155px;
height: 650px;
background-color: #57C194;
float:left;
position: absolute;
display: none;
}
#menu a:hover + #hover1{
display: block;
}
Here's a view of the menu https://i.sstatic.net/n5e9s.png
And the result I want https://i.sstatic.net/6snWn.png
EDIT: I'm willing to use jquery.
With what you've got above; a simple jQuery example would be something like:
$('#menu a')
.on('mouseover', function (event) {
$('#hover1').show();
})
.on('mouseout', function (event) {
$('#hover1').hide();
});
EDIT:
The reason might be because the DOM elements aren't ready.
Try wrapping the above code with:
$(function () {
// above code here
});
or if that doesn't work:
$(document).ready(function () {
// above code here
});