I have a navigation menu. When the user leaves the li I want the menu to wait for a short value of time before closing. Previously I made the code apply which worked fine until I wanted to give different delays. The issue is the event does not trigger.
I tried making a version of the item on jsfiddle which works fine - https://jsfiddle.net/cv6t7yqw/
My code:
$("#nextLeftNav li, #prevLeftNav li").on("mouseleave", function (event) {
var element = $(event.currentTarget);
element.removeClass("hover");
var delayMs = 600;
if($(this).is("#nextLeftNav li"))
{
delayMs = 3000;
}
timeOutMethod = setTimeout(timeoutNavbar, delayMs, element);
});
function timeoutNavbar(){
console.log("timeOutNavBar")
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<div id="prevLeftNav">
<li>
<span class="chevron top">
</span>
</li>
</div>
When I inspect prevLeftNav's only li I see the dimensions of around 200x20 and can physically see the li.