main menu: handle titles that are images

This commit is contained in:
rolux 2014-05-08 13:34:28 +02:00 committed by j
parent 7f410b6048
commit ac059ba618

View file

@ -70,9 +70,9 @@ Ox.MainMenu = function(options, self) {
}
function click(event) {
var $target = $(event.target),
position = typeof $target.data('position') != 'undefined'
? $target.data('position') : -1;
var $element = getElement(event),
position = typeof $element.data('position') != 'undefined'
? $element.data('position') : -1;
clickTitle(position);
}
@ -91,11 +91,16 @@ Ox.MainMenu = function(options, self) {
}
}
function getElement(event) {
var $element = $(event.target);
return $element.is('img') ? $element.parent() : $element;
}
function mousemove(event) {
var $target = $(event.target),
var $element = getElement(event),
focused,
position = typeof $target.data('position') != 'undefined'
? $target.data('position') : -1;
position = typeof $element.data('position') != 'undefined'
? $element.data('position') : -1;
if (self.focused && position != self.selected) {
if (position > -1) {
clickTitle(position);