如何更改畫布內元素的zindex?html canvas zindex
示例代碼:
fabric.Image.fromURL('http://nocookie.net/bw.jpg', function(image) {
image.set('left', 200).set('top', 250);
canvas.add(image);
});
var helloWorld = new fabric.Text('Hello world!', {
left: 0,
top: 0,
fontfamily: 'delicious_500',
zindex: 10
});
canvas.add(helloWorld);
使用fabric.js庫。
以供將來參考:
fabric.Element.html#bringForward
您可以發佈一個例子嗎? [你真的在畫布上有元素嗎?](http://www.youtube.com/watch?v=Guwvwp0uSU8) – sdleihssirhc
@sdleihssirhc發佈了一些示例代碼來展示我的意思。我希望能夠設置圖像上方的文字。 – Mark
哇,[fabric.js文檔](http://kangax.github.com/fabric.js/docs/)是沒用的。 – sdleihssirhc