gpt4 book ai didi

javascript - 使用 Lightbox2 加载包含在 div 中的 SVG

转载 作者:太空宇宙 更新时间:2023-11-03 17:57:25 25 4
gpt4 key购买 nike

如何使用 Lightbox2 显示包含在 div 中的 SVG?在下面的示例中,我想加载包含在 id 为 testsvg 的 div 中的 SVG:

<div id="testsvg">
<svg width="400" height="180">
<rect x="50" y="20" width="150" height="150" style="fill:blue;stroke:pink;stroke-width:5;opacity:0.5">
</svg>
</div>

<a href="#testsvg" data-lightbox="image-1" data-title="My caption">Test SVG!</a>

最佳答案

试试这个

body {
position: relative;
}
#testsvg + a {
position: absolute;
top: 43%;
left: 11%;
}
<div id="testsvg">
<svg width="400" height="180">
<rect x="50" y="20" width="150" height="150" style="fill:blue;stroke:pink;stroke-width:5;opacity:0.5">
</svg>
</div>

<a href="#testsvg" data-lightbox="image-1" data-title="My caption">Test SVG!</a>

关于javascript - 使用 Lightbox2 加载包含在 div 中的 SVG,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26031313/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com