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.

  • "Douglas Rhiner" started this thread

Posts: 89

Location: Fairfax, CA

Occupation: Code-Slave

  • Send private message

1

Tuesday, May 7th 2013, 7:27pm

Addressable <layer>s

Ultimately I'm seeking the ability to address a layer( <div> ), via the DOM, that has been created by KRPano in HTML5 mode.

Background:
In HTML5 mode, a layer seems to be translated into a <div> that has no id or name associated with it.
Here is an example:

The following KRPano <layer> element...
<layer name="testlayer"
type="container"
keep="true"
visible="true"
enabled="true"
zorder="1"
align="bottomleft"
x="120" y="0"
width="100"
height="20"
bgcolor="0xCCCCCC"
bgalpha="0.5"
>
</layer>

Translates to a <div> in HTML5 mode...
<div style="position: absolute; z-index: 3002; overflow: visible; cursor: default; pointer-events: none; opacity: 1; background-color: rgba(204, 204, 204, 0.498039); width: 100px; height: 20px; -webkit-transform: translateZ(1000000000000px) translate(120px, 678px) translate(-50px, 10px) rotate(0deg) translate(50px, -10px); background-size: 0px; background-position: 0px 0px;"></div>

The fact that it has no NAME or ID associated with it makes it nearly impossible to access via the DOM.

I'm not so interested in begin able to manipulate most aspects of the <div> but I am interested in being able to inject raw HTML into the innerHTML attribute via AJAX.
If the <div>s created by KRPano had a NAME or ID this would be possible.

Or is this possible now? *confused*

2

Tuesday, May 7th 2013, 9:28pm

Hi,

see here:
http://krpano.com/docu/xml/#layer.sprite

Btw - using innerHTML would be NOT recommend - this would remove also all children elements of the element and could also break some events and might be also problematic for some other cases - better create a new html element and add it via appendChild.

Btw2 - the best solution for your request (inject raw HTML) might be a small js plugin - see here - in the example code there a new html element (a canvas element in the example) also was added via appendChild:
http://krpano.com/docu/plugininterface/#js

Best regards,
Klaus

  • "Douglas Rhiner" started this thread

Posts: 89

Location: Fairfax, CA

Occupation: Code-Slave

  • Send private message

3

Tuesday, May 7th 2013, 11:33pm

You just made my life a lot easier.
Thank you.