Expand/Collapse not working on published site

I have the same issue the other way around on all pages with collapsed elements. Code works published but not in preview. In preview, it resizes all “collapsed” elements and shifts them to left of screen. Then on return to the editor from preview, the same elements are in their new undesired resized state. In most cases, the resizing can be returned to desired state with an UNDO in the editor. This resizing issue occurs whether collapsed by code at onReady or collapsed as set in Default Value. If collapse is removed from both onReady and Default Value, thereby rendered expanded onReady and only collapsed by user action (onClick), the elements retain their state in preview. The following screen shots from an example page are 1) in editor prior to preview, 2) in preview, 3) back in editor after preview, and 4) the code. Without this being fixed, the only way to test a page is in the published site… not a good practice. This problem is new. All pages with this issue worked properly until the past day.

@Marlowe (Wix) Hi there, my collapse function is no longer working either: https://www.deepvalleybookfestival.com/.

I used Dev mode to create dynamic a dynamic social media bar that only shows the social media icons that each individual author has. It was working before, but not all the social media icons are showing up regardless if they have that social media or not.

Here is an author page, you can see all social media links are showing up, when they were not before: https://www.deepvalleybookfestival.com/team/will-weaver.

Please help as this site is currently live.

Was this every resolved or did anyone ever find a solution? @marlowe-shaeffer

for me it also didn’t work. I then just used show() and hide()

Hello,
If you are still experiencing problems with collapse and expand, please submit a bug report. Check out this post for instructions on how to submit the report: https://www.wix.com/velo/forum/coding-with-velo/how-to-report-a-bug-1

Still unfixed. It’s been more than a year and half since it was reported (at time of writing) and expand/collapse are not working. I was banging my head against the wall thinking I had made some mistake.

Hi, I’m facing the same issue. Did you solve it?

I was able to get it working in this way. I selected the element and made it collapsed buy default. I also added an ID so that I could target it with code (see below)

This is the code I have running on the page…


$w.onReady(function () {

    if(*some condition here*) { 
      $w("#myElement").collapse();
    } else {
      $w("#myElement").expand();
    }

});

any update on this? my expand collapse items are still not working on a live and published site. its for a admin page, so not accessible to public, but see code below.
my code is over 1000 lines ling so cannot post evrythig, but even if I delete all code and only keep the onReady function, the collapse/expand does not work. and when I replace the collapse/expand with hide/show it also does not work. help?

import wixData from ‘wix-data’;
import wixUsers from ‘wix-users’;
import wixWindow from ‘wix-window’;
import wixLocation from ‘wix-location’; // Import wixLocation for page navigation
import { triggeredEmails } from ‘wix-crm’;
import { sendEventEmail } from ‘backend/EventRegistration’; // Adjust path as necessary

let origin = “”;
let fieldToUse = “”;
let selectedvalue_edit = “”
let selectedvalue_delete = “”

$w.onReady(function () {

$w('#section2').scrollTo();
$w("#table1").hide();
$w('#edit1').hide();
$w('#text32').hide();
$w('#columnStrip8').hide();
$w('#columnStrip9').hide();
$w('#columnStrip10').hide();
$w('#button23').hide();
$w('#button24').hide();
$w('#Jobs').hide();
$w('#Offers').hide();
$w('#JobSeekers').hide();
$w('#RecruitmentTransactions').hide();
$w('#Blogs').hide();
$w('#section3').hide();

hideAndCheckRoles();

});