我正在尝试从这里使用 SQUARIFIC 操纵杆控制https://github.com/Squarific/Touchscreen-Joystick#readme
但我不知道如何在我的页面上显示它,这是我当前的代码
<script src="/socket.io/socket.io.js"></script>
<script src="/joystick.js"></script>
<script>
var socket = io.connect('localhost');
socket.on('serverStatus', function (data) {
document.getElementById("serverState").innerHTML=data.status;
});
socket.on('arduinoStatus', function (data) {
document.getElementById("arduinoState").innerHTML=data.status;
});
socket.on('leftPingStatus', function (data) {
document.getElementById("leftPing").innerHTML=data.status;
});
socket.on('rightPingStatus', function (data) {
document.getElementById("rightPing").innerHTML=data.status;
});
var steeringJoystick = new SQUARIFIC.framework.TouchControl(document.getElementById(document.steering),
pretendArrowKeys: false,
mindistance: 25,
maxdistance: 75,
middleLeft: 25,
middleTop: 25
});
</script>
<html>
<body>
<center>
<p id="serverState">Server Disconnected</p>
<p id="arduinoState">Arduino Disconnected</p>
Left <p id="leftPing">0</p>
Right <p id="rightPing">0</p>
<br>
<p id="steering">JOYSTICK SHOULD BE HERE</p>
</center>
</body>
</html>
谁能帮助我了解我应该如何使用这个控件?
谢谢乔