Skip to content

Instantly share code, notes, and snippets.

@RyanABailey
Created August 7, 2014 04:56
Show Gist options
  • Save RyanABailey/8f22b9fdc4c31c27c9f3 to your computer and use it in GitHub Desktop.
Save RyanABailey/8f22b9fdc4c31c27c9f3 to your computer and use it in GitHub Desktop.
angularJs hover example
$scope.openMenu = function() {
// code to expand menu
};
$scope.checkCloseLanguageSelector = function () {
if (isHovered($('#menu'))) {
$scope.closeMenu = false;
}
};
function isHovered(elt) {
var temp = $(elt).parent().find(":hover");
return temp.length == 1 && temp[0] == elt;
}
$scope.closeMenu = function() {
// code to collapse menu
};
<div id="menu" ng-mouseover="openMenu()" ng-mouseleave="checkCloseMenu()">
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment