I have a function that is run when you mouseover and mouseout of a div. When you mouseout I need the function to wait a second before running. Is there a way to set a timeout on an if else statement to make this work?
HTML:
<div ng-mouseover="menu()" ng-mouseout="menu()"><img src="images/headermenubutton.png" style="height: 73px; width: auto; position: absolute; left: 230px; z-index: 2000;"></div>
<div class="menu" ng-mouseover="menu()" ng-mouseout="menu()" ng-show="dropdown_menu" ng-cloak>
<a href="about_us.html"><h2 class="lighter" style="padding-top: 10px;">ABOUT US</h2></a>
<a href="contact_us.html"><h2 class="lighter">CONTACT US</h2></a>
<a href="/blog"><h2 class="lighter">BLOG</h2></a>
<a href="contact_us.html#faq"><h2 class="lighter">FAQ'S</h2></a>
</div>
JS:
$scope.menu = function() {
if($scope.dropdown_menu) {
setTimeout(function(){ $scope.dropdown_menu = false; }, 1000);
} else {
$scope.dropdown_menu = true;
}
};