Project front-end page needs to be implemented, the page no one to operate into the countdown, the following is the front-end code implementation.
Set (Countdown function) switch
var _mouseactivelistener_flag = true;
Beforecount: Trigger countdown interval (in milliseconds)
Count: Countdown total (in seconds)
var mouseactivelistener = function (Beforecount, count, callback) {//config var __countdown_html = ' <div id= ' __tt ' s Tyle= "Position:fixed;top:110px;right:10px;z-index:1000;color: #eee; font-size:25px;"
></div> ';
define var target = null, _t = NULL, _TC = NULL;
var target_countdown = function (__count) {if (__count >= 0) {target.innerhtml = __count + ' seconds after exit ';
_TC = settimeout (function () {Target_countdown (__count);
}, 1000);
else {callback ();
} __count--; }, _t_exec = function () {return settimeout (function () {if (_mouseactivelistener_flag) {target = Ne.dom.createE
L (__countdown_html);
Document.body.appendChild (target);
Target_countdown (count);
}}, Beforecount);
}, _t_clear = function () {cleartimeout (_t);
Cleartimeout (_TC);
Target.parentElement.removeChild (target);
$ (target). Remove ();
target = null;
};
exec _t = _t_exec ();
Document.addeventlistener (' click ', Function () {_t_clear ();
_t = _t_exec (); });
};
After the operation, explained: After 5 seconds (5000) does not operate the state to trigger the countdown, the countdown 180 seconds, the concrete view code inside function.
Mouseactivelistener (5000, 180, function () {
window.location.href = "/home/index";
});
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.