Sometimes this can happen in my experience. I do not know what is happening in the html5 canvas API. If you want to draw a shape under the div element, use the img tag below.
--- This code example is written with prototype.js (1.6) ---
<-javascript code β
var canvas = $('canvas'); canvas.width = 200; canvas.height = 200; var ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.arc(100, 100, 100, 0, - 360 * Math.PI / 180, true); ctx.fillStyle = 'rgba(204, 204, 255, 1)'; ctx.strokeStyle = 'rgba(0, 51, 153, 1)'; ctx.fill(); ctx.stroke(); var imgStr = canvas.toDataURL(); var element = new Element('img', {'src' : imgStr); var target = $('layer1'); target.insert(element);
<- html β
<div id='layer2' style='z-index : 50;'> </div> <canvas id='canvas' style='z-index : 30;'></canvas> <div id='layer1' style='z-index : 10;'></div>
By the way, my homepage is written in Japanese.
mike_neck
source share