Search...
src
Sets or gets the file location of the vector image.
Description
Setting the src
property changes the displayed vector image to
the vector image found at the new src
value.
Getting the src
property returns the location of the
current vector image file.
The vector image file can be an image file from the Media Manager, an external SVG image from any web location, or a literal SVG XML string.
The formats supported are:
- Vector images from the Media Manager:
wix:vector://v1/<vector_uri>/<filename>
- Vector images from the web:
http(s)://<vector image url>
- Vector XML string:
<svg>...</svg>
Type:
stringRead & Write, default value is An empty string
Was this helpful?
Get the vector image's location
Copy Code
1let backgroundSource = $w("#myImage").src;2// "wix:vector://v1/e033af19096e0d6c6dd519476a38e709_svgshape.v1.Tree11.svg/Beach%20Tree.svg"
Set the vector image to be a vector image from the Media Manager
Copy Code
1$w("#myElement").src = "wix:vector://v1/e033af19096e0d6c6dd519476a38e709_svgshape.v1.Tree11.svg/Beach%20Tree.svg";
Set the vector image to be a vector image from the web
Copy Code
1$w("#myElement").src = "https://mdn.github.io/learning-area/html/multimedia-and-embedding/adding-vector-graphics-to-the-web/star.svg";
Set the vector image to be a vector image from an XML string
Copy Code
1$w("#myElement").src = '<svg width="50" height="50"><circle cx="25" cy="25" r="20" stroke="red" stroke-width="5" fill="blue"/></svg>';