引导菜单javascript函数在IE8中不起作用

时间:2016-02-18 12:01:59

标签: javascript jquery twitter-bootstrap internet-explorer-8

我有一个使用以下Jquery下滑的引导菜单,它适用于除IE8之外的所有内容。有没有人有任何建议如何让它在IE8中工作?感谢

(function ($, window, delay) {
  var theTimer = 0;
  var theElement = null;
    var theLastPosition = {x:0,y:0};
  $('.dropdown')
    .closest('li')
    .on('mouseenter', function (inEvent) {
    if (theElement) theElement.find('.dropdown-menu').stop(true,true).slideUp();
    if (theElement) theElement.removeClass('open');
    window.clearTimeout(theTimer);
    theElement = $(this);

    theTimer = window.setTimeout(function () {
      theElement.find('.dropdown-menu').stop(true,true).slideDown();
      theElement.addClass('open');
    }, delay);
  })
    .on('mousemove', function (inEvent) {
        if(Math.abs(theLastPosition.x - inEvent.ScreenX) > 4 || 
           Math.abs(theLastPosition.y - inEvent.ScreenY) > 4)
        {
            theLastPosition.x = inEvent.ScreenX;
            theLastPosition.y = inEvent.ScreenY;
            return;
        }

    if (theElement.hasClass('open')) return;
    window.clearTimeout(theTimer);
    theTimer = window.setTimeout(function () {
      theElement.find('.dropdown-menu').stop(true,true).slideDown();
      theElement.addClass('open');
    }, delay);
  })
    .on('mouseleave', function (inEvent) {
    window.clearTimeout(theTimer);
    theElement = $(this);
    theTimer = window.setTimeout(function () {
      theElement.find('.dropdown-menu').stop(true,true).slideUp();
      theElement.removeClass('open');
    }, delay);
  });
})(jQuery, window, 200);

0 个答案:

没有答案