debugging - Safari 上没有弹出窗口。使用交互式 SVG
问题描述
我使用 SVG 制作了一个交互式工作流。这个是用 Adobe XD 制作的,并将其转换为一个工作流程,其中每个按钮都会打开一个弹出模式并显示一个视频(如灯箱)。
我遇到的问题是按钮无法使用 Safari。使用 Google Chrome 或 Firefox 确实有效。我该怎么做才能使这项工作也适用于 Safari?
您可以通过 Fiddle 查看交互式工作流程的示例。
要重现该问题,您应该在 Safari 中打开该链接。如果你想看看它应该如何工作,你应该使用 Chrome 或 Firefox
-- 编辑 25-03-19 --
感谢您的帮助,但答案不起作用。Xlink:herf 有点旧,不适用于 Safari。也许它适用于常规链接,但我无法让我的模式弹出窗口工作。
我在http://jsbin.com/lajilacajumu/1/edit?html,css,output找到了我遇到的问题的一个工作示例
还对我在示例中看到的信息进行了预览。
.hoverable-rect {
cursor:pointer
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Bug Report</title>
<!-- Bootstrap's CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.css" rel="stylesheet">
</head>
<body>
<!-- the different buttons comes here -->
<div class="container">
<svg viewBox="0 0 1920 1080">
<g class="hoverable-rect" data-toggle="modal" data-target="#modal1" id="g3223" id="prime-ppd" transform="translate(175.776 781.062)">
<g id="prime-elements">
<rect id="prime-bg" width="50" height="50" x="0" y="0" fill="#0094db"/>
<text id="PRIME" transform="translate(4.65 26.098)" fill="#fff" font-size="11" font-family="HelveticaNeue-Medium, Helvetica Neue" font-weight="500" letter-spacing="-0.002em"><tspan x="0" y="0">PRIME</tspan></text>
</g>
</g>
</svg>
<!-- all different modals comes here -->
<div class="modal fade overlay" id="modal1" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
<iframe src="https://player.vimeo.com/video/303329059?autoplay=1&loop=1&autopause=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
</div>
</div>
</div>
</div>
</body>
<!-- jQuery and Bootstrap's JavaScript-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/latest/js/bootstrap.js"></script>
</html>
解决方案
代替
<a href="whatever">
尝试
<a xlink:href="whatever">
SVG<a>
元素与 HTML<a>
元素不同。在 SVG 版本中,您使用xlink:href
.
SVG 2 中删除了对前缀的这一要求xlink:
。但并非所有浏览器都实现了这一点。
推荐阅读
- compiler-construction - 有没有 Yacc 可以表达但 Antlr4 无法表达的语言语法示例?
- php - Laravel:当我使用自定义请求类验证表单请求时出现错误“未定义的变量”
- python - 在 Shell 中使用日志重定向时如何获取函数的重调代码?
- selenium - 我需要去几个网站并获取特定的数据集
- ruby-on-rails - 传递“参数”时出现类型错误(没有将符号隐式转换为整数)
- javascript - 单击注销按钮后,以前的 url 不应该工作
- javascript - 制表符:打印输出功能不会打印出表格中的进度条
- javascript - 如果存在重复值,如何合并对象数组,如果键是通用的,则将通用值合并到单个键中
- git - 为什么本地分支文件被还原?
- hadoop - 使用 Hive 将表数据从一个 Hadoop 环境传输到另一个 Hadoop 环境并使用 oozie 进行调度