Select to view content in your preferred language

SVG

1003
2
03-14-2017 12:55 PM
GregRieck
Frequent Contributor

Hello,

I have an svg string that I'd like to add to a widget. How do I go about doing that? I'm using WAB 2.2 with a Jewelry Box theme.

Thank You Greg

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Greg,

  What doe mean you want to use a SVG string?  SVG files can be used in a CSS rule as a background-image for a button or div.

i.e.:

.jimu-widget-layerList .jimu-dropmenu .jimu-icon-btn{
  width: 22px;
  height: 22px;
  min-width: 13px;
  background-image: url("../images/more_normal.svg");
  background-color: rgba(255, 255, 255, 0);
  border: 0 solid;
}
GregRieck
Frequent Contributor

Hi Robert,

I resolved this on my own.

I changed the html by adding another div

<div>
<div id="svgContainer"></div>
</div> 

Then I added it to the widget using JQuery

var svg = MyFunctionReturnedSVGString;

$('#svgContainer').html(svg);

Greg

0 Kudos