Before "Page Interactive" is ready

I have default $w(“#button”).collapse() and then placed $w(“#button”).expand() within $w.onReady, but still the button is not interactive(clickable) when it has expanded, it still takes 3-4 seconds extra after it is expanded until it is interactive.

Are there any solutions to hide/collapse elements until they are ready to interact?

You might be able to fix this by checking which render process you’re in. Use the Rendering.env to check if you are in the browser render, and then expand the button. In this way, the button is only expanded when the page in the browser is ready.

import wixWindow from 'wix-window';

$w.onReady(function () {
   if (wixWindow.rendering.env === "browser") {
       $w("#button").expand();
   }
});

Problem solved! Thank you Yisrael :smiley: