用jquery 和 jquery.simulate.js 实现模拟键盘事件,点击上下左右div相当于点击键盘的上下左右键
#box {
width: 50px;
height: 50px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: lightskyblue;
}
.box-wrapper {
width: 100px;
height: 100px;
position: fixed;
bottom: 0;
left: 0;
background: blue;
}
.box {
float: left;
background-color: orange;
font-size: 30px;
width: 50px;
text-align: center;
height: 50px;
}
.box:nth-child(1){
background-color: pink;
}
.box:nth-child(4){
background-color: blueviolet;
}
window.onload = function() {
var box1 = document.getElementById("box");
document.