Add simple html to hotspot text

181 views
Skip to first unread message

Sebastian Malinowski

unread,
Jul 21, 2016, 9:23:48 AM7/21/16
to marzipano
Hello community,

i was experimenting with marzipano and it is quite amazing. My requirements are low i just want to add simple html to hotspots like
<a href="http://www.w3schools.com" target="_blank">Visit W3Schools.com!</a>

I obviously cannot write the HTML code directly in the "text" variable in data.js

 "infoHotspots": [
        {
          "yaw": 2.133675189068951,
          "pitch": -0.07705615698236734,
          "title": "Some text here",
          "text": "<a href="http://www.w3schools.com" target="_blank">Visit W3Schools.com!</a>"
        }
      ]

when i do this the whole tour does not work at all (black screen in browser


I would be very grateful if someone could help :)


Thanks in advance and kind regards

MaLi

Tiago Quelhas

unread,
Jul 21, 2016, 1:19:39 PM7/21/16
to Sebastian Malinowski, marzipano
The value of the text property can't contain quotes, since these are
used to delimit the value itself. You should either use single quotes:

"text": "<a href='...'>...</a>"

or escape the quotes with a backslash:

"text": "<a href=\"...\">...</a>"

This approach is fine for simple cases, but if the HTML gets too
complex, it's probably a better idea to add it to the index.html file
and use the createHotspot() API to create a hotspot out of it.
> --
> You received this message because you are subscribed to the Google Groups
> "marzipano" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to marzipano+...@googlegroups.com.
> To post to this group, send email to marz...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/marzipano/e8b568ad-09b4-44e7-a51c-e1dd0c75c4d6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages