如果页面滚动的话,会出现一些视差,办法:
body.onmousemove = function(e){ var event = e || window.event; canvas.mouse = { x: event.offsetX, y: event.offsetY } }回复
鼠标全屏不用经过 移到canvas画布上触发效果
body.onmousemove = function(e) { var event = e || window.event; canvas.mouse = { x: event.clientX, y: event.clientY } }
修改body 为window
window.onmousemove = function(e) { var event = e || window.event; canvas.mouse = { x: event.clientX, y: event.clientY } }
全屏显示
修改
// 获取特定div的宽高 var width = window.innerWeight || document.documentElement.clientWidth || document.body.clientWidth; var height = window.innerWeight || document.documentElement.clientHeight || document.body.clientHeight;回复