使用Raphael.js绘制图像 [英] Drawing over an image using Raphael.js

查看:221
本文介绍了使用Raphael.js绘制图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以将Raphael.js画布放在 IMG 元素上吗?

Can I put a Raphael.js canvas over an IMG element? What should I do make this layout work?

推荐答案

只需使用普通CSS技术将Raphaël画布置于图像元素的顶部即可:

Simply position the Raphaël canvas over the top of the image element using normal CSS techniques:

#wrapper {
    position: relative;
    padding: 0;
    outline: 1px solid #999;
}
#wrapper img {
    position: absolute;
    top: 0;
    left: 0;
}
#canvas {
    position: absolute;
    top: 0;
    left: 0;
}

然后嵌套您的元素:

<div id="wrapper">
    <img src="myimage.jpg">
    <div id="canvas">  
    </div>
</div>

这是一个完整的示例

这篇关于使用Raphael.js绘制图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆