如何动态取代这张照片? (不删除html SVG元素并重新渲染)
xlink:href="http://missosology.info/forum/download/file.php?avatar=11666_1307312313.jpg"
代码: https://jsfiddle.net/bfv17f0e/
<svg class="clip-svg user-img" width="36" height="36" viewBox="0 0 560 645">
<defs>
<clipPath id="polygon-clip">
<polygon points="270,0 0,160 0,485 270,445 560,0 0,160"></polygon>
</clipPath>
</defs>
<image clip-path="url(#polygon-clip)"
height="100%"
width="100%"
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="http://missosology.info/forum/download/file.php?avatar=11666_1307312313.jpg"
>
</image>
</svg>
修改
$('image').attr('xlink:href', 'new image'); its not working not replacing the image, how do i replace that url?
答案 0 :(得分:0)
作品。
$('image').attr('xlink:href', newPath)