You are not logged in.

1

Sunday, April 13th 2014, 12:48pm

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.

Source code

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.

Source code

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

Sage

Posts: 3,839

Location: Netherlands

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

  • Send private message

2

Sunday, April 13th 2014, 1:11pm

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

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

3

Sunday, April 13th 2014, 5:20pm

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

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

4

Sunday, April 13th 2014, 6:22pm

+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

Sage

Posts: 3,839

Location: Netherlands

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

  • Send private message

5

Sunday, April 13th 2014, 10:44pm

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