Some code and animation not functioning on live site

Hi there.

I’ve just published my site and noticed that some buttons are not working properly… sometimes they load the information and sometimes nothing happens. When the elements do load, the animation on them doesn’t work. Everything appears good on the unpublished site, so I am unsure what is going on.

Can anyone advise? Many thanks…

David

What code are you using and what is or isn’t happening with your elements? Elaborate a little bit more please for further help from other users in this forum.

Have you got anything on your browser that is blocking something like a third party popup blocker etc that Wix or your own website needs to be whitelisted in so anything from Wix or your website, like cookies etc, can be obtained from your website?

Hi there,

Thanks for the quick reply.

The code is used on several buttons which are meant to ‘show’ hidden elements. Sometimes they do work, and sometimes they don’t. When the elements do appear, the animation on them doesn’t work.

An example of one of the button codes is:

export function button21_click(event) {

$w(“#vectorImage35”).hide()
$w(“#line37”).hide()
$w(“#vectorImage38”).hide()
$w(“#button41”).hide()
$w(“#line36”).hide()
$w(“#button45”).hide()
$w(“#vectorImage36”).hide()
$w(“#line36”).hide()
$w(“#button44”).hide()
$w(“#vectorImage34”).hide()
$w(“#line35”).hide()
$w(“#button43”).hide()
$w(“#vectorImage37”).hide()
$w(“#button32”).show()
$w(“#button42”).hide()
$w(“#line34”).hide()
$w(“#button33”).hide()
$w(“#vectorImage2”).show()
$w(“#line15”).show()
$w(“#vectorImage1”).show()
$w(“#button23”).show()
$w(“#group13”).show()
$w(“#line18”).show()
$w(“#vectorImage3”).show()
$w(“#button24”).show()
$w(“#button40”).show()
$w(“#group25”).hide()
$w(“#group25”).collapse()

    } 

Funnily enough, when the code doesn’t show the hidden elements, it does always do the last action of collapsing group25…

No, I don’t have any blockers on my browser… I also spoke with something from the WIx team earlier this evening, and she tested the buttons on her browser and had the same issue…

*spoke with SOMEONE from the Wix team

That is a long list of elements to have to put into your code, can’t you group some of them together or have them in strips etc, so that they can all be shown or hidden as one and then you only have the one item to add to your code.

I did similar on my Members Only page and had a lot of member only elements that I wanted hidden until the user logs themselves in, so I simply put all my hidden elements into one strip and then only had to add my strip every time as show or hide, much easier than having to type everything out again and again.

Anyways, as for your code, you need to be putting a ‘;’ at the end of each line as shown below:

$w("#myElement").show();

See the api for more info about hide, show, collapse, expand etc:
HiddenCollapsedMixin - Velo API Reference - Wix.com

For a Wix Editor example, look at this tutorial here:
https://www.wix.com/corvid/example/hide-and-show-elements

Note that for the above tutorial, you don’t have to actually log yourself into the Wix Editor if you only want to see the code example and not see how it is all setup in Wix Editor.

Simply scroll towards the bottom of that page and you will see a black box called ‘Example Code’, simply select page 1 code from the dropdown to view it.

Hello,

Thank you for your reply.

I have now sorted the issue with my coding (I hope!)…

I’m not sure about the semi-colon after the coding… none of my coding has it, and it appears to work fine (?) Maybe it’s a preference thing…

I’m now just having an issue with the animation, which is still not working.

Any suggestions on what could be causing animation issues?

Still having issues with the buttons, too… sometimes they load the elements, sometimes they don’t. Ughh…