Toggle Autotour with button?

  • Hi everyone,

    I'm using the new Krpano 1.20.8. It has a nice feature that easily allows you to make an autotour from your virtual tour. However I haven't found a way to toggle that effect with a button. I can only activate it by either writing "true" or "false" in the skin settings of the tour.xml.
    Is there a way to easily use a button as a layer that enables the user to switch it on or off during the tour? (I'm a newbie at coding)

    There is an option to activate and deactivate the autotour by doing a right-click and selecting it in the drop down menu, basically I want exactly that option as a button in the virtual tour.

    Thanks!

    David

    Edited once, last by 6av16 (November 18, 2020 at 11:58 AM).

  • Hi,

    switching autorotate.enabled works, but there is also a slightly better solution:

    Code
    onclick="if(autorotate.isrotating, autorotate.stop(), autorotate.start() );"

    This way the autorotate/autotour starts instantly when enabling it, otherwise it would wait the waittime before it starts after enabling.

    Documentation:
    https://krpano.com/docu/xml/#autorotate.start

    Best regards,
    Klaus

  • Hi,

    switching autorotate.enabled works, but there is also a slightly better solution:

    Code
    onclick="if(autorotate.isrotating, autorotate.stop(), autorotate.start() );"

    This way the autorotate/autotour starts instantly when enabling it, otherwise it would wait the waittime before it starts after enabling.

    Documentation:
    https://krpano.com/docu/xml/#autorotate.start

    Best regards,
    Klaus


    Hi Klaus,
    this seams not to work when a waittime >1 is active.
    Do you have a solution?

    My Code:

    Code
    <events onloadcomplete="set(autorotate.enabled,true);autorotate.start();" />
     <autorotate enabled="true" waittime="5" /> 
    
    
    <layer name="skin_btn_autorotate"  onclick="if(autorotate.isrotating, autorotate.stop(), autorotate.start() );" />
  • Yes, it is possible to create a button in Krpano that toggles the autotour feature on and off. You can do this by adding a button layer to your virtual tour and attaching an onclick event that toggles the value of the "autorotate.enabled" variable between "true" and "false

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!