Do I use , <>, >

后端 未结 15 2036
借酒劲吻你
借酒劲吻你 2020-11-22 06:10

Should I use , , or for loading SVG files into a page in a way similar to loading a jpg
15条回答
  •  滥情空心
    2020-11-22 06:59

    and have an interesting property: they make it possible to obtain a reference to SVG document from outer document (taking same-origin policy into account). The reference can then be used to animate the SVG, change its stylesheets, etc.

    Given

    
    

    You can then do things like

    document.getElementById("svg1").addEventListener("load", function() {
        var doc = this.getSVGDocument();
        var rect = doc.querySelector("rect"); // suppose our image contains a 
        rect.setAttribute("fill", "green");
    });
    

    提交回复
    热议问题