I've been unable to use local image as node background in cytoscape.js no matter the syntax.
On styles.json I've tried:
"selector": "node[ id = '6104' ]",
"css": {
"background-image": "image.jpg",
also
"background-image": "url(image.jpg)",
also
"background-image": "data(image.jpg)",
also
"background-image": "url(./image.jpg)",
among others... nothing seems to work. Using a web url for image works fine. Just not local files. Any suggestions? Thanks in advance
This does not answer the question directly, but offer a workaround.
You can convert the images to Base64 code and use the "encodeURI()" function to get it done.
Here is a demo code (click
Run code snippetbutton to see the result):