【问题标题】:ng-idle is not working in IE9 and IE10ng-idle 在 IE9 和 IE10 中不起作用
【发布时间】:2015-06-09 06:30:51
【问题描述】:

ng-idle 在 IE9 和 IE10 中不起作用。假设如果您将鼠标指针留在页面上,则不考虑用户处于非活动状态。当您将鼠标指针保持在页面之外时,它正在工作。

请为此提供解决方案。

使用以下网址进行检查 http://hackedbychinese.github.io/ng-idle/

【问题讨论】:

    标签: javascript angularjs ng-idle


    【解决方案1】:

    替换

    $document.find('body').on(options.interrupt, function(event) {
        svc.interrupt();
    }
    

    在 angular-idle.js 中使用以下代码

    $document.find('body').on(options.interrupt, function(event) {
        if (event.type !== 'mousemove' || (event.movementX || event.movementY)) {
            svc.interrupt();
        }
    });
    

    【讨论】:

      【解决方案2】:

      看来问题出在 mousemove 事件上,快速修复它可以是删除 IE 浏览器的 mousemove 事件。使用useragent编写条件语句,使用ng-idleinterrupt()方法配置事件。

      if (navigator.userAgent.toLowerCase().indexOf("msie") > 0) {
                  // Code for Internet Explorer because ng-idle doesn't stop listening mousemove event.
                  IdleProvider.interrupt('keydown DOMMouseScroll mousewheel mousedown touchstart touchmove scroll'); 
              }
              else {
                  IdleProvider.interrupt('mousemove keydown DOMMouseScroll mousewheel mousedown touchstart touchmove scroll'); 
              } 
      

      【讨论】:

        猜你喜欢
        • 2013-06-30
        • 2014-03-24
        • 2023-03-10
        • 2013-02-23
        • 2019-10-02
        • 1970-01-01
        • 1970-01-01
        • 2013-12-15
        • 2012-12-08
        相关资源
        最近更新 更多