简体   繁体   English

具有xlink的SVG文件到AMP项目中的另一个页面

[英]SVG file with xlink to another page in AMP project

I have an SVG file containing a number of xlinks that navigate to a different page. 我有一个SVG文件,其中包含许多xlink,这些xlink可以导航到其他页面。 For example: 例如:

<a xlink:href="us/ak">...</a>

The SVG is a US map, and I'd be happy to provide it, but it's too big to include here. SVG是一张美国地图,我很乐意提供,但是太大了,无法在此处包含。

When I try to use this SVG in an AMP page, the xlinks don't work. 当我尝试在AMP页面中使用此SVG时,xlink不起作用。 I see in the AMP spec that xlinks in an SVG are required to have a target URI starting with "#", so I think that's why my xlink isn't working. 我在AMP规范中看到,要求SVG中的xlink必须具有以“#”开头的目标URI,所以我认为这就是我的xlink无法正常工作的原因。 It behaves the same whether I use an amp-img or img tag. 无论我使用amp-img还是img标签,其行为都相同。

It works fine if I put it in an img tag on a non-AMP page. 如果我将其放在非AMP页面上的img标签中,则效果很好。

Is there a way to get my links to go to a new page, and not just to a #-link on the same page? 有没有一种方法可以使我的链接转到新页面,而不仅仅是同一页面上的#-链接?

The color change on hover also stops working when I put the SVG on an AMP page, but I'm tackling one problem at a time. 当我将SVG放在AMP页面上时,悬停时的颜色更改也停止工作,但是我一次解决了一个问题。

如果您只想链接到另一个页面,则<a href="...">应该可以使用...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM