1 apiready = function() { 2 var winWidth = api.winWidth; 3 var winHeight = api.winHeight; 4 console.log(winHeight); 5 var canvasList = document.getElementById('leftjoystick'); 6 var canvas = document.createElement('canvas'); 7 $api.css(canvasList,'margin-top:' + 2*winHeight/5 +'px;margin-left:'+winWidth/15 +'px;') 8 // canvasList.marginLeft = winWidth / 10; 9 // canvasList.marginTop = winHeight / 5; 10 canvasList.appendChild(canvas); 11 // if(api.systemType == 'ios') 12 canvas.width = winHeight / 1.8; //☜ 13 canvas.height = winHeight / 1.8; 14 //... 15 //最后再执行画图操作 16 }