Sie sind nicht angemeldet.

1

Donnerstag, 9. Februar 2017, 11:36

Switch „mobile“ vs. „normal"

Hallo,

i am trying to make a switch between big and small display sizes for different navigation.
I thought about using

<include url="..." devices="mobile" /> vs <include url="..." devices=„normal" />
But my Macbook 15“ doesn´t get recognized as „normal“ (Other points like toch, mouse, html5… are recognized correctly on my macbook)

Does anyone have an idea why it doesn´t get recognized as „normal"

What would be the best simple way to switch between big (800 pixel or more) and small screen sizes?

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »flow« (9. Februar 2017, 15:41)


2

Samstag, 11. Februar 2017, 01:39

Try „normal" -> "normal" https://krpano.com/docu/actions/#device.normal
What you want to switch? GUI buttons, image sizes? If you like to load other xml when e.g. screenwidth lower than 800px you can do something like:

Quellcode

1
<include url="small_gui.xml" if="stagewidth LT 800" />
but be aware this can load other xml at the beggining but in case resolution / orientation¸change your stagewidth could become bigger => you need to consider dynamic change via onresize event

3

Samstag, 11. Februar 2017, 13:28

Hi,

Does anyone have an idea why it doesn´t get recognized as „normal"
Too old krpano version?
The device.normal was first added in 1.19-pr2.
Or wrong usage...
Or browser caching of old files...

What would be the best simple way to switch between big (800 pixel or more) and small screen sizes?
There is no universal 'best way'!
The best way is always individually ;-).

The normal/mobile devices settings don't relate to the screen/pixel size. If you want something window-size depended, the onresize event would need to be used - e.g. here some custom sample code:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<events onresize="handle_different_window_sizes()" />

<action name="handle_different_window_sizes">
  if(stagewidth LT 800, set(size_mode, 'small'), set(size_mode, 'big'));
  if(size_mode != last_size_mode,
    copy(last_size_mode, size_mode);
    if(size_mode == 'small',
      <!-- .... here set all small sizes -->
      set(layer[logo].width, 100);
      set(layer[map].width, 200);
    ,
      <!-- .... here set all big sizes -->
      set(layer[logo].width, 200);
      set(layer[map].width, 300);
    );
  );
</action>


Best regards,
Klaus