You are not logged in.

1

Wednesday, February 2nd 2022, 10:33am

Add diffrent hotspot image url for mobile table and desktop view

Hi I want to add single hotspot with two different image one for mobile and one for desktop using javascript.

I am using below code to add hotspot using javascript.


var mouse_at_h = this.defaultHotspot.ath;

var mouse_at_v = this.defaultHotspot.atv;
var krpano = this.krpanoObj.get('global');
var krpanoHotSpot = krpano.addhotspot('auto');
krpanoHotSpot.url = markerImage;
krpanoHotSpot.ath = mouse_at_h;
krpanoHotSpot.atv = mouse_at_v;
krpanoHotSpot.name = this.hotSpotName;
krpanoHotSpot.accuracy = 1;
krpanoHotSpot.alpha = '1.0';
krpanoHotSpot.scale = 1;
krpanoHotSpot.zoom = false;
krpanoHotSpot.rotate = 0;
krpanoHotSpot.dragging = false; // a custom setting for enabling/disabling the dragging
krpanoHotSpot.enabled = true;
krpanoHotSpot.visible = true;
krpanoHotSpot.renderer = 'css3d';
krpanoHotSpot.edge = 'bottom';
krpanoHotSpot.x = 0;
krpanoHotSpot.y = -10;


Here I want to add url for mobile device and desktop like this : -


krpanoHotSpot.url.no-mobile= markerImage;
krpanoHotSpot.url.mobile = mobileImage;

but here no-mobile and mobile properties are not working so not able to add these in xml.

Also the krapano should detect the device based on that hotspot image should load both for mobile and desktop.
I have tried this but it is not working can someone guide me here. *smile*

This post has been edited 1 times, last edit by "vishruttechtic" (Feb 3rd 2022, 10:46am)


2

Thursday, February 3rd 2022, 5:55am

Any update on above question I have a deadline so any help will be appreciated *smile*

3

Thursday, February 3rd 2022, 1:59pm

The device object can be used for checking:
https://krpano.com/docu/actions/#device

Here an example:

Source code

1
krpanoHotSpot.url = krpano.device.mobile ? mobileImage : markerImage;