My code is working in preview, but no working when published.

Hi, I’m new here, and a make that question in the portuguese Velo Wix Forum, but no one aswer me back.

I have a slider on my site (boassolucoes.com.br) in the anchor ‘’ Soluções’‘, and I program that when someone click in ‘’ X button’’ go to slide 1’', and worked fine im the preview mode. But when I Published, the buttons simply dont work.

Here are the codes that I’m using, if anyone can help-me:

let mySlides = $w( “#fullWidthSlides4” ).slides;

let numSlides = mySlides.length; // 7
let firstSlideName = mySlides[ 0 ].name; // “Slide 1”

export function image22_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 1 )}
//
export function button11_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function button12_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function image24_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 2 )}

export function button13_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function image25_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 3 )}

export function button14_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function image26_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 4 )}

export function button15_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function image28_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 5 )}

export function button16_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function image23_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 6 )}

export function button17_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function image27_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 7 )}

Obs: Is working on the mobile version, but not in the desktop version

  1. Check DATABASE-PERMISSIONS.
  2. Check if you have synced your PREVIEW and LIVE-DBs.

How can I do it? Where can i find databasse permissions? , and, how can I Check if a synced the preview with live? I’m new in this Velo Wix.

On the left side in your Wix-Editor, you will see …

…there you can choose the right database.
On the right side on the very bottom of this pic, you can see […] 3-points (a sign for a menu). Click on it and take a look onto the options.

When I Try to find, I Don’t found any databasses that I Created by myself.

What I made:

The slider don’t have the option to link a button to a slide, so a click in ‘’ Advanced mode > Page Code > Masterpage.js, find here in the forum the right code (change slide) and put it all in this page. I don’t creat any databasse.

Look the print:

That databasse was created by wix when I created que form, so, I really don’t know whats can I do, and, why the code is working in the mobile version, and not working in desktop.

Ok, i think i was on the wrong way, with my suggestion.

Did you connect all your export functions in your Wix-Ui ?
I do not use the js.files, so i think i can’t really help in this case.

And i also do not know, why you should put this code into the js-file and not into the normal page-code-section.

@russian-dima I put the code in all the pages that i can lol, in the normal page code, in master js file.

How can i export function in the wix ui?

@michaeldiascoach
Normaly when you add some events to your element, the code is written automaticaly into the right code-section…

But sometimes this connection can get lost, so that no action is running after a click. So you will have to reconnect your element with the code-function again.

Or you can do it another way…

$w.onReady(()=>{
    let mySlides = $w("#fullWidthSlides4").slides;  
    let numSlides = mySlides.length;  
    
    $w('#image22').onClick(()=>{ $w("#fullWidthSlides4").changeSlide(1)}
    $w('#button11').onClick(()=>{ $w("#fullWidthSlides4").changeSlide(0)}
    $w('#button12').onClick(()=>{ $w("#fullWidthSlides4").changeSlide(0)}
    //.....and so on ....
})

Thank for the tips! But now is showing another error:

My bad!
Forgot → ) <—

$w('#image22').onClick(()=>    {$w("#fullWidthSlides4").changeSlide(1)})   $w('#button11').onClick(()=>   {$w("#fullWidthSlides4").changeSlide(0)})    $w('#button12').onClick(()=>   {$w("#fullWidthSlides4").changeSlide(0)})    
//.....and so on .... })

@russian-dima Thanks you!! I Solve the problem in the other way, more simple than that!

I only use the begining of your code:
$w.onReady(()=>{
and put all the code again, and start to work in desktop version ‘-’, only this.

the final code is:

$w.onReady(()=>{

let mySlides = $w( “#fullWidthSlides4” ).slides;

let numSlides = mySlides.length; // 7
let firstSlideName = mySlides[ 0 ].name;}) // “Slide 1”

export function image22_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 1 )}
//
export function button11_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function button12_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function image24_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 2 )}

export function button13_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function image25_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 3 )}

export function button14_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function image26_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 4 )}

export function button15_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function image28_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 5 )}

export function button16_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function image23_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 6 )}

export function button17_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 0 )}

export function image27_click(event){
$w( “#fullWidthSlides4” ).changeSlide( 7 )}

So if you are reading this, remember to use the on ready function in your site!
That save my life! Thank you so much!

@michaeldiascoach
Well done. Glad i could help you.