Sie sind nicht angemeldet.

1

Donnerstag, 4. Dezember 2014, 21:48

Dynamic sizing for image popups. Global 'width' parameter.

Hello all!

I have a number of image layers in my pano, that popup when a certain hotspot is clicked:


<layer name="image1" type="image" url="evidence/01-evidence-lockpicks.jpg" style="popups"/>
<layer name="image2" type="image" url="evidence/02-evidence-toy_aeroplane.jpg" style="popups"/>
etc.

As you can see, they have the common style 'popups' set.

Is it possible within that style to have a width that is set dependant on the stagewidth? I.e. if stagewidth is greater than 1080px then image popup width is 960px, else image popup width is 90%.

I've tried a few things, but haven't got it working. Can image width be set to 'a variable'?

Thanks in advance.

Sam

2

Donnerstag, 4. Dezember 2014, 22:25

Alternatively, perhaps someone could tell me how to alter this code so that it applies to image1, image2, image3 etc. without just duplicating it?

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
<events name="image_scale" onresize="image_automatic_fit_inside();" />

<action name="image_automatic_fit_inside">
    if(layer[image1].loaded,
        div(screenaspect, stagewidth, stageheight);
        div(imageaspect, layer[image1].imagewidth, layer[image1].imageheight);
        if(imageaspect GT screenaspect,
            set(layer[image1].width,90%); set(layer[image1].height,prop);
            ,
            set(layer[image1].width,prop); set(layer[image1].height,90%);
        );
    );
</action>

3

Montag, 8. Dezember 2014, 13:01

use only one image layer changing url for other images and calling image_automatic_fit_inside on loaded-