Adjust to screen size (HELP!)

Hi everyone!

I’m trying to get my website to adapt to the screen resolution…

I’ve Googled it, WixCoded it, Support Forumed it and I just cannot seem to get my website to adapt to the screen size.

Can anyone prove it works? Can someone spoon feed me, as I don’t even know if I am using the right code! I’m using Wix Window with the following code:

import wixWindow from ‘wix-window’;

// …

wixWindow.getBoundingRect()
.then( (windowSizeInfo) => {
let windowHeight = windowSizeInfo.window.height; // 565
let windowWidth = windowSizeInfo.window.width; // 1269
let documentHeight = windowSizeInfo.document.height; // 780
let documentWidth = windowSizeInfo.document.width; // 1269
let scrollX = windowSizeInfo.scroll.x; // 0
let scrollY = windowSizeInfo.scroll.y; // 120
} );

Is this the one…?
I’d really appreciate some help!

Dan

1 Like

Programmatically adapting screen size/resolution is currently not available in Wix Code. Feel free to post a Feature Request .

Hello Daniel,
You are on the right track. To do this, you want to group all elements of a size into one group ‘size1’, and so on for all the different sizes your site is being built around. After that simply hide/show groups bases on size. So for example if the width is greater than 1440, then show group 1 and hide group 2, else do the opposite
Here is some code to get you started

Best,
Majd

Hi Majd,

I understood your codes. However, I am unsure on how do I indicate the webpage viewed on my PC to be size 1 and the webpage viewed on my monitor to be size 2?

Do you know how to do that?