svg

SVG <use xlink:href> from a CDN

那年仲夏 提交于 2021-02-07 13:37:49
问题 I am using the <use xlink:href> to reference my svg file. It works fine on my local but throws an error (CORS) when I reference it from a CDN. It looks as though the xlink:href doesn't allow the CORS request but I am wondering if there is any solution? On the other hand, I have heard that this sprite technique is deprecated on SVG2 . So what is the best solution to use sprite SVG file for now that works on all different browsers including mobile browsers. 回答1: The simplest cross-browser

SVG <use xlink:href> from a CDN

孤人 提交于 2021-02-07 13:36:07
问题 I am using the <use xlink:href> to reference my svg file. It works fine on my local but throws an error (CORS) when I reference it from a CDN. It looks as though the xlink:href doesn't allow the CORS request but I am wondering if there is any solution? On the other hand, I have heard that this sprite technique is deprecated on SVG2 . So what is the best solution to use sprite SVG file for now that works on all different browsers including mobile browsers. 回答1: The simplest cross-browser

Why does this SVG image have a height of 150px

六眼飞鱼酱① 提交于 2021-02-07 13:00:47
问题 Why is this SVG image displayed at 150px height inside this 500px container? Why this specific value? I found this weird behavior in both js bin and Codepen, so I think it is something to do with my code and not with the online editors. Note: a 700px div container results in the same thing. So the height of the parent doesn't matter. <div style="padding: 30px; background-color: yellow; height: 500px; width: 500px; "> <svg> <pattern id="basicPattern" x="10" y="10" width="40" height="40"

Wrap existing SVG elements in G tag

亡梦爱人 提交于 2021-02-07 12:55:20
问题 This seems like it'd be a simple question to answer but I'm having a hard time doing so: Is it possible to "wrap" existing SVG shapes in a new SVG g tag (i.e. group) using d3.js, the way .wrap() works in jQuery? If I were to simply create a new g tag "manually", how would I then go about moving an existing element into that g? 回答1: If you pass an existing DOM element to append or insert , the element (and it's children) will be moved from their current place in the DOM hierarchy to wherever

Are SVG fonts still working in Google Chrome?

冷暖自知 提交于 2021-02-07 12:29:18
问题 I have been redesigning a website for a while on and off, but for the last 6 months I've been out of the loop so to speak and may have missed something important regarding svg fonts no longer working with chrome? Here is a snippet of one of my stylesheets: @media screen and (-webkit-min-device-pixel-ratio:0) { @font-face { font-family: 'NewFont'; src: url("newfont-webfont.svg#NewFont") format("svg"); }} I've replaced the SVG with my WOFF version and the fonts look just about OK, however the

Inline SVG disappears in iOSand Safari when a CSS filter is applied

为君一笑 提交于 2021-02-07 11:55:39
问题 The situation is I have an inline SVG generated by Grunticon and inserted into the DOM. It's white on a grey background with a drop-shadow. I used the following CSS for the shadow: svg { -webkit-filter: drop-shadow(1px 1px 0 #141414); filter: drop-shadow(1px 1px 0 #141414); } This works fine in Chrome, Opera, Firefox and everywhere else I've tested it, except Safari on iOS and desktop. The CSS filter makes the SVG disappear. It's not just the drop-shadow filter either, any filter seems to

how does fill-rule=“evenodd” work on a star SVG

我的未来我决定 提交于 2021-02-07 11:33:50
问题 I saw the following svg shape when i was trying to understand fill-rule in SVG <div class="contain-demo"> <svg width="250px" height="250px" viewBox="0 0 250 250"> <desc>Yellow star with intersecting paths to demonstrate evenodd value.</desc> <polygon fill="#F9F38C" fill-rule="evenodd" stroke="#E5D50C" stroke-width="5" stroke-linejoin="round" points="47.773,241.534 123.868,8.466 200.427,241.534 7.784,98.208 242.216,98.208 " /> </svg> </div> Please note the following: The SVG has just one path.

Fill color SVG path with animation

大憨熊 提交于 2021-02-07 10:10:58
问题 I have use following way to fill color of SVG paths. Is there a way to add animation to it. Color filling starting from center and spread. $(function(){ $("#btn-test1").on("click",function(){ $("#path1").attr("fill","#0000"); }); }); 回答1: This answer provides four different options to animate the fill color of a SVG path using jQuery.animate(), CSS @keyframes and SVG SMIL-Animation: #1 jQuery.animate() and SVG <radialGradient> $(function(){ $("button").on("click",function(){ $(this).animate(

Fill color SVG path with animation

徘徊边缘 提交于 2021-02-07 10:09:46
问题 I have use following way to fill color of SVG paths. Is there a way to add animation to it. Color filling starting from center and spread. $(function(){ $("#btn-test1").on("click",function(){ $("#path1").attr("fill","#0000"); }); }); 回答1: This answer provides four different options to animate the fill color of a SVG path using jQuery.animate(), CSS @keyframes and SVG SMIL-Animation: #1 jQuery.animate() and SVG <radialGradient> $(function(){ $("button").on("click",function(){ $(this).animate(

How to parse SVG path component to UIBezierPath using SVGKit in iOS?

六月ゝ 毕业季﹏ 提交于 2021-02-07 08:19:52
问题 I am animating a SVG image in iOS using Swift. I have been able to render the SVG easily using SVGKit (https://github.com/SVGKit/SVGKit) but to animate it I need to convert the SVG path element to UIBezierPath. I can do so using other libraries but it'd be nice if I could do all of it using SVGKit alone. I haven't find any straight forward way to get the path element as well. 回答1: I had the same issues with Swift and using SVGKit. Even after following this simple tutorial and converting it to