Technical help need here please - I've been trying for 1.5 days!

Nick-Abbott wrote on 4/22/2022, 6:33 AM

Dear Fellow Xara folk,

As you may be aware, the inner workings of a rendered Xara web page that is configured so as to 'Scale to fit width' render with the following top level <div> (key attribute highlighted) ...

<div id="xr_xr" class="xr_noc" style="width: 1921px; height: 1267px; position: relative; text-align: left; margin: 0px auto; z-index: 2; zoom: 0.296875;" onmousedown="xr_mm(event);">

I am trying to use pure JavaScript to act on the value of the

... zoom: 0.296875...

... portion on my case.

But, no matter what I try - and have been trying for the best part of two days - I cannot read the actual value of that style attribute.

Yes, I see easily 'see' it in a browser Inspector such as Chrome's and Firefox's using...

alert(window.getComputedStyle(document.getElementById('xr_xr')).getPropertyValue("zoom"));

...but the value of ...

getPropertyValue("zoom")

... is simply not available when the JavaScript is running inline - i.e. when I include it in the Xara document's <head>.

Can someone PLEASE give me some expert guidance here.

Maybe I'm going about this the wrong way?

What I want actually achieve is to have some way, (any way) of getting a relative value for the scaling that is being applied in any given viewport size.

That's all I need, just a single variable that I can query to find out how much the document is scaled up or down by.

Just clarify the broader picture here, the reason why I want to do this is so that I can use the embedded JavaScript to react to viewport size (media queries I guess) and show/hide elements on the page according.

Any offers from folk with better JS skills than I out there?

Thank you!

Nick

Comments

emmrecs wrote on 4/22/2022, 8:37 AM

@Nick-Abbott

Welcome to the Magix user to user forums.

I honestly don't know whether anyone who visits and posts here will be able to help you with this question, sorry.

In the meantime, I suggest you register at and repost to the TalkGraphics forum, where there are very experienced users of Xara graphics products, including XDP.

HTH

Jeff
Forum Moderator

Win 10 Pro 64 bit, Intel i7 Quad Core 6700K @ 4GHz, 32 GB RAM, NVidia GTX 1660TI and Intel HD530 Graphics, MOTU 8-Pre f/w audio interface, VPX, MEP, Music Maker, PhotoStory Deluxe, Photo Manager Deluxe, Xara 3D Maker 7, Reaper, Adobe Audition 3, CS6 and CC, 2 x Canon HG10 cameras, 1 x Canon EOS 600D, Akaso EK7000 Pro Action Cam

johnebaker wrote on 4/22/2022, 10:32 AM

@Nick-Abbott

Hi

. . . . getPropertyValue("zoom") . . . .

Is the element fully qualified as in the alert function in your Javascript?

John EB
Forum Moderator

Last changed by johnebaker on 4/22/2022, 10:36 AM, changed a total of 2 times.

VPX 16, Movie Studio 2025, and earlier versions 2015 and 2016, Music Maker Premium 2024.

PC - running Windows 11 23H2 Professional on Intel i7-8700K 3.2 GHz, 16GB RAM, RTX 2060 6GB 192-bit GDDR6, 1 x 1Tb Sabrent NVME SSD (OS and programs), 2 x 4TB (Data) internal HDD + 1TB internal SSD (Work disc), + 6 ext backup HDDs.

Laptop - Lenovo Legion 5i Phantom - running Windows 11 23H2 on Intel Core i7-10750H, 16GB DDR4-SDRAM, 512GB SSD, 43.9 cm screen Full HD 1920 x 1080, Intel UHD 630 iGPU and NVIDIA GeForce RTX 2060 (6GB GDDR6)

Sony FDR-AX53e Video camera, DJI Osmo Action 3 and Sony HDR-AS30V Sports cams.