const mouseEvents = (controls, camera) => {
const rootDiv= document.getElementById('root');
const leftDiv = rootDiv.getElementsByClassName('left');
const rightDiv = rootDiv.getElementsByClassName('right');
const mapDiv = rootDiv.getElementsByClassName('map');
const left = document.getElementById('map');
let count = 0;
let outTime = 1;
window.setInterval(go, 1000);
function go() {
count++;
if (count == outTime * 60) {
window.location.href = "tianjin.html?backurl=" + window.location.href;
}
}
let x;
let y;
left.addEventListener("mousemove", function(e){
let x1 = e.clientX;
let y1 = e.clientY;
if (x != x1 || y != y1) {
count = 0;
}
x = x1;
y = y1;
});
left.addEventListener("mousewheel", function(e){
count = 0;
});
left.addEventListener("click", function(e){
count = 0;
});
}
参考文献: https://www.bbsmax.com/A/gVdnZMwldW/
|