var User_Toolbar = { init: function () { var container = $('#links-user'); $('.user-top-dd', container).dropdownHover({}); $('.dropdown input, .dropdown label', container).click(function(e) { e.stopPropagation(); }); if (navigator.userAgent.match(/Firefox/)) { this.ffDropdownHack(); } }, ffDropdownHack: function () { var theTimer = 0; var delay = 2000; var theElement = $('#loginBox'); var elementLastPosition = {x:0,y:0}; theElement .on('mousemove.userLoginForm', function (inEvent) { elementLastPosition.x = inEvent.screenX; elementLastPosition.y = inEvent.screenY; clearTimeout(theTimer); }) .on('mouseleave.userLoginForm', function (inEvent) { $(window).on('mousemove.userLoginForm', function (inEvent) { if(Math.abs(elementLastPosition.x - inEvent.screenX) > 4 || Math.abs(elementLastPosition.y - inEvent.screenY) > 4) { clearTimeout(theTimer); theTimer = setTimeout(function () { theElement.closest('li').removeClass('open'); }, delay); $(window).off('mousemove.userLoginForm'); } }); return false; }); } };