Suddenly my lightbox close buttons on my functioning published site have stopped working.
When you click on them nothing happens.
They used to work fine and I have changed nothing in this code.
Has something changed?
Please post the URL of your site and explain how and where to see the problem.
I found something!
There has been a change to the way site code works.
In my site code, I change properties of elements that are in the site header (mostly ‘show()’ and ‘hide()’)
When pages with the header are active, the code works fine.
When a lightbox (which has no header) is active those statements are syntax errors.
This used to work, but now it doesn’t.
How do I get around this?
Hey Bill, can you please post your site’s url and specify where should we see the changes that were made?
Thanks
Shahar,
Thank you for responding.
The failures are all in the member area, so I would have to set up a login for you to view them. But it does not matter because my question is now a general one.
Here are the relevant contents of my masterPage.js file:
import wixUsers from ‘wix-users’ ;
import {getArtistDirectoryProfile} from ‘public/welcome.js’ ;
$w.onReady( async function () {
let artistDirectoryProfile = await getArtistDirectoryProfile ();
if (wixUsers.currentUser.loggedIn) {
$w( ‘#containerArtistMenu’ ).show();
$w( ‘#buttonLogout’ ).show();
$w( ‘#buttonMember’ ).label = "Welcome " + artistDirectoryProfile.registrationEmail;
} else {
$w( ‘#containerArtistMenu’ ).hide();
$w( ‘#buttonLogout’ ).hide();
$w( ‘#buttonMember’ ).label = “Artist Sign-in” ;
}
})
The elements referenced are all in the header, and they need to be set on every page. That’s why I put them in the masterPage.js (site) file.
The problem is that for a lightbox, the element references now throw syntax errors. This did not used to happen; this file has been working fine on the public site for over a year. It just started breaking in the last few weeks.
The question is what is the correct way to control these elements in the header?
Cheers,
Bill
@bill " It just started breaking in the last few weeks." …and that’s why we can’t help unless you post the URL of your site.
This issue is partially answered in my new post: Rich Text Box issue (bug)
However, another question remains unanswered. I would really like to know the proper way to code instructions to elements in my site header. Previously I had always put them in the masterPage.js (site) file (see my code snippet above). But recently these instructions began causing syntax errors on pages with no header (like lightboxes) because there are no such elements on those pages. So there must be a better way. Can anyone show me how to do it properly?
Cheers,
Bill