jQuery IdleTimeOut插件集成错误

时间:2018-10-23 05:20:43

标签: javascript jquery

enter image description here enter image description here enter image description here enter image description here我正在尝试使用jquery-Idletimeout插件在选项卡和窗口之间自动注销。但我收到错误消息:

Uncaught TypeError: e(...).dialog is not a function

我包含以下版本的jquery,jquery ui,store.js,jquery idletimeout.min.js:

<script src="{% static 'dev/others/jquery-2.2.4.min.js' %}"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>

<script src="{% static 'vendors/storejs/dist/store.everything.min.js' %}"></script>
<script src="{% static 'vendors/idletimeout_plugin/jquery-idleTimeout.min.js' %}"></script>

在我的js文件中,我将脚本包括为:

$(document).ready(function () {
  $(document).idleTimeout({
    redirectUrl: 'https://github.com/JillElaine/jquery-idleTimeout', // redirect to this url
    idleTimeLimit: 15, // 15 seconds
    activityEvents: 'click keypress scroll wheel mousewheel', // separate each event with a space
    dialogDisplayLimit: 30, // Time to display the warning dialog before logout (and optional callback) in seconds
    sessionKeepAliveTimer: false // Set to false to disable pings.
  });
});

我也提供了“网络”标签的屏幕截图。

但是我得到了上面解释的错误。

有任何调试此错误的建议吗?

1 个答案:

答案 0 :(得分:0)

看起来您在以下部分中调用的jquery文件没有被加载。请您打开Chrome中的网络工具,然后给我JS标签页的快照。

<script src="{% static 'dev/others/jquery-2.2.4.min.js' %}"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>

<script src="{% static 'vendors/storejs/dist/store.everything.min.js' %}"></script>
<script src="{% static 'vendors/idletimeout_plugin/jquery-idleTimeout.min.js' %}"></script>