Show / Hide div from hotspot?

  • Hi all,

    I'd really like to get a hotspot to show/hide a DIV on click.
    I've looked through heaps of posts, but I'm not sure where to begin.
    I think this is my lack of understanding of how to call an external javascript from the viewer (if that's possible?)
    I've checked out the javascript-interface examples and am still none the wiser.

    Any advise/pointers would be much appreciated.

    Cheers

  • Hi mrrickus.

    It is quite easy, don't get complicated, look:

    krpano syntax:
    js( jsfunction(parameters*) )


    now, krpano only reachs functions in global scope, so if you are using a framework such as jQuery or MooTools, take that into account, it won't be able to call functions made inside "onDomReady" or "onLoad" or any other function scope if you don't keep a global reference to that.


    Now, as you want to hide a "div", you must affect it's "visibility" style property to achieve that.


    Let's say the div has an id property like this:

    Code
    <div id="myElementId">Content</div>


    You may also have a function like this:


    and now, you should make it being called from the hotspot.

    Code
    <hotspot name="myhotspot" onclick="js(hideEl("myElementId"));" />
  • HI ciul,

    I managed to get most of the way there after a few more hours of head scratching, but your reply has made this sooooo much clearer for me - you are a star! All is well with the world again.

    Many thanks.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!