If you wish to keep the recent states even after page refresh, you will have to store the states in the browser cache (local or session), and once the $w got ready, retrieve the stored states and apply them to the elements.
See:
https://www.wix.com/velo/reference/wix-storage/session
https://www.wix.com/velo/reference/wix-storage/local