当前位置: 首页 > 工具软件 > Scroll Follow > 使用案例 >

html5 div scroll,html - html5 canvas scroll - Stack Overflow

范甫
2023-12-01

i have a requirement that I need to create a canvas and draw inside it programattically and put it inside a marquee, all these through javascript. Is it possible ? a few pointers please

As a follow-up: i wrote the following, it creates the canvas but does not scrolll it, but the hard coded marquee works !

you are welcome

function btnClicked()

{

alert('here');

var canvas = document.createElement('canvas');

context = canvas.getContext('2d');

// Draw whatever on your canvas

context.beginPath();

context.moveTo(70, 140);

context.lineTo(140, 70);

context.stroke();

var div = document.createElement('div');

div.appendChild(canvas);

var marquee = document.createElement('marquee');

marquee.appendChild(div);

document.body.appendChild(marquee);

}

 类似资料: