Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
how can I put a button inside the html to close html div?
Hi,
see the 'Here a link for testing the krpano JS API' part in the example.
It shows how to call any krpano code and that can be also used to remove or hide the layer (e.g. call removelayer or set visible to false).
Best regards,
Klaus
Hi Klaus
"Here a link"
I don´t see it
Thanks
Suso
This post has been edited 1 times, last edit by "Fernando" (Nov 7th 2018, 1:16am)
![]() |
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 |
<action name="add_html_code" type="Javascript"><![CDATA[ var div = document.createElement("div"); // basic styles to fit into the layer size and allow scrolling: div.id = "mylist"; div.style.width = "100%"; div.style.height = "100%"; div.style.overflow = "auto"; div.style.boxSizing = "border-box"; div.style.padding = args[2] ? (args[2] + "px") : "0"; |
![]() |
Source code |
1 2 3 4 5 6 7 8 9 |
<action name="show_scroll" type="Javascript"> <![CDATA[ var name = "list_scroll"; list_scroll=document.getElementById('mylist').scrollTop krpano.set("myscroll", list_scroll);krpano.showlog();krpano.trace(get(myscroll)); ]]> </action> |
![]() |
Source code |
1 2 3 4 5 6 7 |
<layer name="show_scroll" type="text" x="10" y="10" html="click to show scroll position" onclick="show_scroll();" /> |
This post has been edited 3 times, last edit by "Fernando" (Apr 4th 2019, 2:35pm) with the following reason: solved
Location: Netherlands
Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
This post has been edited 3 times, last edit by "klaea" (May 29th 2019, 2:51pm)
This post has been edited 1 times, last edit by "Red" (Jul 8th 2019, 3:27pm)
Is it possible to change the width of the scroll and its color on the mobile?Hi,
there were recently a few requests about how to bring a html div element into krpano and allow using the 'native' browser-based scrolling (e.g. by mouse-wheel, scroll-bars or touch-controls) inside it.
Just adding html-code would be possible also by using the textfield plugin and scrolling could be added by using the scrollarea plugin, but for letting the browser handle the scrolling it gets a bit more tricky because in this case the event-handling between krpano and the browser would need to get 'coordinated' correctly.
Therefore here a full example:
Example
XML Source
Is uses a normal container element puts any kind of html-content inside it.
I'm also considering bringing that functionality directly into krpano, maybe as extended textfield or as layer with type="html" or something like that.
Best regards,
Klaus
![]() |
Source code |
1 2 3 |
<div id="close" onclick="document.getElementById('krpanoSWFObject').call('set(layer[html_div].visible,false); set(layer[html_div].enabled,false);')" > <img src="close.png" style="width:20; height:20px; cursor:pointer; float:right;" /> </div> |
![]() |
Source code |
1 2 |
<img src="close.png" style="width:20; height:20px; cursor:pointer; float: right;" onclick="document.getElementById('krpanoSWFObject').call('set(layer[html_div].visible,false);set(layer[html_div].enabled,false);')"/> |
This post has been edited 1 times, last edit by "San7" (Nov 23rd 2019, 10:22am)