是否可以用 RaphaelJS 覆盖 Span/UL/LI
我刚刚开始使用 RaphaelJS(尽管我熟悉 SVG),并尝试在许多图像上实现自定义叠加。我的图像组织如下(id仅供参考):
<div id="parent">
<ul>
<li>
<a>
<span id="imageholder">
<img>
每个
和10个
code> per
有6个
基于特定的数据标准,我想在此集合中的图像子集上放置动态叠加层。我尝试了几种不同的技术:
1- 将兄弟 div
中包含的整个 div
放在“父级”中。
2- 每个 span
1 篇论文作为“imageholder”的同级 span
。
3- 整个 div
的单篇论文作为“父级”的子级。
4- 整个 div
的单个 Paper 作为 body
的顶级子级。
在所有情况下,svg 都位于要覆盖的下方(或者根本不可见)。我假设这与所涉及元素上的内联与块显示有关,但我不确定。
I'm just starting out with RaphaelJS (though I am familiar with SVG) and am attempting to implement custom overlays over a number of images. My images are organized like so (ids are only for reference):
<div id="parent">
<ul>
<li>
<a>
<span id="imageholder">
<img>
with 6 <li>
per <ul>
and 10 <ul>
per <div>
Based on specific data criteria, I would like to place a dynamic overlay over a subset of the images in this collection. I've attempted a few different techniques:
1- Single Paper for the entire div
contained in a sibling div
to "parent."
2- 1 paper for each span
as a sibling span
to "imageholder."
3- Single paper for entire div
as a child of "parent."
4- Single Paper for entire div
as a top level child of body
.
In all cases, the svg is below that which it is to overlay (or isn't visible at all). I'm assuming that this has something to do with inline
vs block
display on the elements involved, but I don't know for sure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这更像是 CSS 问题,而不是 js/raphael 问题。
更强大的解决方案是为每个
span
创建一个新论文作为同级文件,否则点击事件将不会注册,因为 svg 元素将位于锚点的顶部。
。尝试...
为了降低调试复杂性,您应该首先尝试用静态 html 覆盖 div,然后您可以让 Raphael 来填充它们的 SVG/VML 魔力。
This is more of a CSS problem than a js/raphael problem.
The more robust solution would be creating a new paper as a sibling for each
span
, otherwise the click events won't register because the svg element will be on top of your anchors<a></a>
.Try with...
To reduce debugging complexity you should try to overlay the divs with static html first and then you can get Raphael to fill them its SVG/VML magic.