绘制的线条不仅出现在Canvas-Element中,而且还出现在页面顶部,再次显示.
发生触摸事件时会发生这种情况.
在这里您可以找到源代码和结果(使用PhoneGap和Jquery Mobile).
有谁知道这个错误的原因是什么?
http://gomami.ch/bugs/screenshot.png http://gomami.ch/bugs/screenshot.png
JavaScript(在包含到jQuery/PhoneGap之后的头文件中加载):
//*********************************************************
// Wait for Cordova to Load
//*********************************************************
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
canvas("aufprallstelleA","test");
}
// function to setup a new canvas for drawing
function canvas(canvas, element){
//define and resize canvas
width = $(window).width();
width = (width/100)*90;
height = width/1.6901408;
$("#content").width(width);
$("#"+element).height(height);
$("#"+element).width(width);
var html = 'This is de Canvas field wehre you can draw<br><canvas id="'+
canvas+'" width="'+width+'" height="'+height+
'" style="border:black solid 1px;background-size: 100%; background-repeat: no-repeat;background-image: url(\'images/allgemein/aufprallstelle.PNG\');"></canvas>';
$("#"+element).html(html);
// setup …Run Code Online (Sandbox Code Playgroud)