You are not logged in.

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.

21

Friday, October 5th 2018, 12:42am

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
tmhok has attached the following image:
  • QQ图片20181005064050.png

Fernando

Intermediate

Posts: 202

Location: Habana, Cuba

Occupation: Architect, Photographer, Programmer.

  • Send private message

22

Tuesday, November 6th 2018, 6:07am

solved: modify style for handheld device

Hi, this is about the klaus example "div inside krpano" and the user indexofrefraction code in order to modify the text of div section for handheld device:

I modified the project for working with styles in HTML file instead multiple styles lines in .xml, example:

old xml (witout use class) :

<data name="info"><![CDATA[
<span style="text-decoration:none;cursor:pointer;font-size:16px;" >
example1
</span><br><br>
(...)
Solution by indexofrefraction user, for change text size if handheld device:
(...)
var ishandheld = document.getElementById('krpanoSWFObject').get('device.handheld');
var fs = (ishandheld == true || ishandheld == 'true') ? 20 : 16;
div.innerHTML = args[1].replace(/font-sizeW:Wd+px/g, 'font-size:'+fs+'px');
(...)


current xml:

<data name="info"><![CDATA[
<span class="panos">
example1
</span><br>

In current html add style definition:
<style>
.panos { color:#B6D1F0;text-decoration:none;cursor:pointer;font-size:1rem }
.panos_handheld { color:#B6D1F0;text-decoration:none;cursor:pointer;font-size:1.5rem }
</style>

For change the chain class="panos", with class="panos_handheld" if the device is handheld, my solution is:


var ishandheld = document.getElementById('krpanoSWFObject').get('device.handheld');
var fs = (ishandheld == true || ishandheld == 'true') ? 'panos_handheld' : 'panos';
div.innerHTML = args[1].replace(/class="panos"/g, 'class='+fs);

(100% inspired (almost copied) in solution of indexofrefraction user *thumbsup* ) Thanks!

Best regards,

Fernando

This post has been edited 1 times, last edit by "Fernando" (Nov 7th 2018, 1:16am)


Fernando

Intermediate

Posts: 202

Location: Habana, Cuba

Occupation: Architect, Photographer, Programmer.

  • Send private message

23

Tuesday, March 26th 2019, 10:00am

[solved] ...get the current scroll position

Hi. if you need to known the current scroll position:

1) set id to the div element:


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";



(...) continued with original klaus code

2. Create js action:

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>



3. Create layer for show scroll position:

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();"
/>



Finish, now you can see the current scroll position for coding.

Best regards,
Fernando

This post has been edited 3 times, last edit by "Fernando" (Apr 4th 2019, 2:35pm) with the following reason: solved


Tuur

Sage

Posts: 3,105

Location: Netherlands

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

  • Send private message

24

Thursday, May 2nd 2019, 3:21pm

edited

...never mind...

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur

ramirox3

Intermediate

Posts: 186

Location: La Ceja, Colombia

Occupation: photographer

  • Send private message

25

Thursday, May 2nd 2019, 11:07pm

ERROR: show_scroll - TypeError: krpano.showlog is not a function

Fernando

Intermediate

Posts: 202

Location: Habana, Cuba

Occupation: Architect, Photographer, Programmer.

  • Send private message

26

Friday, May 3rd 2019, 3:49pm

working example

This is the full example. To use:Change the scroll position, then Press first button to copy this position, change again the scroll position, press the second button to restore the saved position.
Best regards,
Fernando
PD.
How to post examples as this without to remove license or encrypt xml?
Fernando has attached the following file:

27

Saturday, May 25th 2019, 4:28pm

Hotspot popup

Hi,

I use the html_div as a hotspot popup. Works great! Nothing fancy, just an action to set the alpha. But I can't figure out how to make the action work for all my popups. One action for all popups instead of creating a new action for every single popup.

Could anyone point me in the right direction?