Sie sind nicht angemeldet.

1

Sonntag, 13. April 2014, 12:48

Hotspot onclick not working, but onhover does

Hi!

I have a very strange problem on my pano. I have set up a hotspot and an image layer that I am controlling from the hotspot. My problem is that the most trivial thing, onclick is not working on my hotspot.

Quellcode

1
<hotspot name="spot3" style="skin_hotspotstyle" ath="45.338" atv="5.682" onclick="set(layer[tree].visible)" onhover="" />



If I do this, nothing ever happens on my hotspot. However if I move my code to the onhover, it works.

Quellcode

1
<hotspot name="spot3" style="skin_hotspotstyle" ath="45.338" atv="5.682" onclick="" onhover="set(layer[tree].visible)" />



It's very frustrating and I need some help from the community. Does anyone have any idea how could I debug this issue?

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

2

Sonntag, 13. April 2014, 13:11

Did you try set(layer[tree].visible,true);
?
Tuur *thumbsup*

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

3

Sonntag, 13. April 2014, 17:20

No, I suppose the problem here is in the style. Your hotspot has style="skin_hotspotstyle" (it's in "vtourskin.xml") and there's "onclick" already defined inside this style, so it overrides your custom onclick event. There's no onhover in this style, so your onhover event works perfectly. So, if this hotspot is unique in it's actions, so remove its style and copy all needed parameters from this style and paste them inside this hotspot. And add your "tree" event to its onclick.
Regards,

Alexey

4

Sonntag, 13. April 2014, 18:22

+1 Alexey

Or you can add your own style and redefine some attributes
for example:

style name="style1" onclick="onclick1()"

style name="style2" onclick="onclick2()"

layer name="layer1" style="style1|style2"

In this case layer.onclick will be - onclick2()

Regards
Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

5

Sonntag, 13. April 2014, 22:44

Offcourse, that's right.
Didn't thnik about that.
Tuur *thumbsup*