JavaScript:
<script>
$('#aboutme').on('hover', function(){
console.log("All the stuff");
/* $("#aboutmedropdown").css("dispay","block"); */
});
</script>
HTML (css inline for now):
<div class="nav">
<ul class="navlist">
<li style="position: relative;"><a href="#"><img src="/img/nav-home.png" alt="Navigation Home"></a></li>
<li style="position: relative;"><a href="#"><img src="/img/nav-about.png" id="aboutme" alt="Navigation About"></a>
<div id="aboutmedropdown" style="width: 150px; position: absolute; background-color: #FFFFFF;">
<ul style="list-style: none; padding: 0; margin: 0; border-bottom: 5px solid #8cc419;" class="sub_menu">
<li style="display: block; font-size: 16px; line-height: 20px; text-align: center; border-bottom: 1px solid #8cc419;"><a href="#" style="color: #8CC419;">About Me</a></li>
<li style="display: block; font-size: 16px; line-height: 20px; color: #8CC419; text-align: center; border-bottom: 1px solid #8cc419;"><a href="#" style="color: #8CC419;">Testimonials</a></li>
</ul>
</div>
</li>
<li style="position: relative;"><a href="#"><img src="/img/nav-yoga.png" alt="Navigation Yoga"></a></li>
<li style="position: relative;"><a href="#"><img src="/img/nav-pilates.png" alt="Navigation Pilates"></a></li>
<li style="position: relative;"><a href="#"><img src="/img/nav-fitness.png" alt="Navigation Fitness"></a></li>
<li style="position: relative;"><a href="#"><img src="/img/nav-media.png" alt="Navigation Media"></a></li>
<li style="position: relative;"><a href="#"><img src="/img/nav-fitcamp.png" alt="Navigation Fitcamp"></a></li>
<li style="position: relative;"><a href="#"><img src="/img/nav-blog.png" alt="Navigation Blog"></a></li>
</ul>
</div>
I am inspecting the element and VERY CLEARLY see that I have the proper ID on the image I need to hover over -- #aboutme
.
I am viewing page source and seeing that both my <script>
, and jQuery
, are loaded.
Yet, when I hover over the image with the id of aboutme
, nothing happens in the console.
Any ideas?
Do not use hover
with the on
, use mouseout
OR the equivalent mouseenter mouseout
(together):
Alternatively use the hover method like so:
$('#aboutme').hover(function() {
console.log('hover in');
}, function() {
console.log('hover out');
});