SVG <a> tags don&#39;t work in Safari

时间:2017-04-18 01:48:01

标签: svg safari modal-dialog webkit anchor

The <a> tags inside my svg link perfectly to my modals in Google Chrome. However, in Safari the links do not work. I thought it was a modal issue, but I tested opening a separate modal and it worked. I think the problem lies in the svg, but I just can't get it to work. Any help would be much appreciated.

SVG html

<object>
    <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1190px" height="1261px" viewBox="0 0 1190 1261" enable-background="new 0 0 1190 1261" xml:space="preserve">
        <a href="#openRoom4_1">
            <polygon class="roomSVGs" fill="blue" points="626,259 827,324 980,191 775,137   "/>
        </a>
    </svg>
</object>

Modal html

        <div id="openRoom4_1" class="modalDialog">
            <div class="roomModal">
                <a href="#close" title="Close" class="close">&times;</a>
                <h2>Room 4.1</h2>
                   <p>Hi</p>
            </div>
        </div>

1 个答案:

答案 0 :(得分:7)

Safari不支持href,如果你想在那里工作,你需要使用xlink:href。

xlink:href是SVG 1.1,href是SVG 2的功能。