You are not logged in.

1

Tuesday, October 18th 2016, 4:13pm

How to disable vtour control bar only for mobile users via JavaScript

Dear krpano enthusiasts,

In my vtour, I'd like that mobile users do NOT see the control bar and that non-mobile users do see it.
Suppose that I want to do this via javascript (thus the JS variable 'ismobile' tells me if a user is mobile or not) and that for both mobile and non-mobile users I load the same xml file.

How can I achieve that?
How can I disable the control bar for mobile users?

Thanks.







A related question is : Removing bottom control bar

Umalo

Professional

Posts: 1,051

Location: Osijek, Croatia, EU

  • Send private message

2

Tuesday, October 18th 2016, 10:24pm

Maybe with:

Source code

1
<include url="skin/vtourskin.xml"       if="device === 'normal'"       />

3

Wednesday, October 19th 2016, 10:16am

Thanks Umalo. Though it does not seem to work. At least on my Desktop I don't see the control bar (even if I replace 'Normal' with 'Desktop').
Actually you mention something I was not aware of: the "if" tag and the condition. What does === mean? Where can I find a documentation for this type of conditions that I'd like to learn about?

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

4

Wednesday, October 19th 2016, 10:32am

Hi)

I guess the right code woudl be

Source code

1
if="device.normal"
But maybe I'm wrong here...



Check out here: http://krpano.com/docu/xml/#if


'===' is 'equal strict' comparison


Read here: http://krpano.com/docu/actions/#expressions
Regards,

Alexey

5

Wednesday, October 19th 2016, 11:29am

It seems to work like this, thanks (again)!