Navigation: Bypass error-prone hover selector for IE8

refs #6417
This commit is contained in:
Marius Hein 2015-01-28 13:19:49 +01:00
parent 49b82af704
commit 7ef86ddf49

View File

@ -130,23 +130,26 @@
} }
setTimeout(function () { setTimeout(function () {
if (! $li.is('li:hover')) { try {
if (!$li.is('li:hover')) {
return; return;
} }
if ($li.hasClass('active')) { if ($li.hasClass('active')) {
return; return;
} }
} catch(e) { /* Bypass because if IE8 */ }
$li.siblings().each(function () { $li.siblings().each(function () {
var $sibling = $(this); var $sibling = $(this);
try {
if ($sibling.is('li:hover')) { if ($sibling.is('li:hover')) {
return; return;
} }
} catch(e) { /* Bypass because if IE8 */ };
if ($sibling.hasClass('hover')) { if ($sibling.hasClass('hover')) {
$sibling.removeClass('hover'); $sibling.removeClass('hover');
} }
}); });
self.hoverElement($li); self.hoverElement($li);
}, delay); }, delay);
}; };
@ -161,9 +164,11 @@
} }
setTimeout(function () { setTimeout(function () {
if ($li.is('li:hover') || $sidebar.is('sidebar:hover') ) { try {
if ($li.is('li:hover') || $sidebar.is('sidebar:hover')) {
return; return;
} }
} catch(e) { /* Bypass because if IE8 */ };
$li.removeClass('hover'); $li.removeClass('hover');
$('#layout').removeClass('hoveredmenu'); $('#layout').removeClass('hoveredmenu');
}, 500); }, 500);
@ -183,9 +188,11 @@
self = event.data.self; self = event.data.self;
setTimeout(function () { setTimeout(function () {
// TODO: make this behave well together with keyboard navigation // TODO: make this behave well together with keyboard navigation
if (! $li.is('li:hover') /*&& ! $li.find('a:focus')*/) { try {
if (!$li.is('li:hover') /*&& ! $li.find('a:focus')*/) {
$li.removeClass('hover'); $li.removeClass('hover');
} }
} catch(e) { /* Bypass because if IE8 */ }
}, 300); }, 300);
}; };
Icinga.Behaviors.Navigation = Navigation; Icinga.Behaviors.Navigation = Navigation;