我正在使用jQuery和jQuery Mobile來創建一個包含多個元素的地圖。這些元素應該代表建築物或建築物的一部分。如果你點擊它們,你應該到另一個頁面或打開一個對話框。SVG中的鏈接與jquery mobile不起作用
最好的解決方案是將SVG代碼放入頁面,因爲它是可縮放的。現在的問題是路徑周圍的鏈接不起作用。它們顯示在每個瀏覽器中,甚至顯示目標鏈接,但它什麼也沒有發生。如果我評論jquery mobile 1.4.5的嵌入,並且它只適用於jquery!
SVG中的示例路徑的代碼示例。它顯示了一個帶有維基百科鏈接的紅色正方形。在jQuery中運行,但不與jQuery Mobile的:
<div data-role="content">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 525 365"
xmlns:xlink="http://www.w3.org/1999/xlink" id="map" preserveAspectRatio="xMinYMin meet">
<a xlink:href="//en.wikipedia.org/wiki/Main_Page">
<path
style="fill:#ff2700;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-
linejoin:miter;stroke-opacity:1;fill-opacity:1"
d="M 24.243661,19.27897 230.31478,11.197749 222.23356,223.32978 18.182746,235.45161 z"
id="path3773"
inkscape:connector-curvature="0"
transform="translate(216.65625,143.28125)" />
</a>
</svg>
</div>