Link

Hi Guys,

I am trying to link a button from an HTML code i wrote to close the lightbox after a countdown timer runs out.

Thanks for the help in advance.

Hi!

Why not using setTimeout( ) and wixWindow.lightbox.close( ) ?
Read about it in the attached articles!

Hope it helps!
Doron. :slight_smile:

Hi Doron,

I read most of the articles related to lightbox.close() but i don’t know why it’s not linking with the embedded HTML code in my lightbox! To explain clearly what i did is i’ve added a lightbox to my website and in the lightbox i added a code for a countdown timer and a button, after that i tried to link the button to the wixwindow.lightbox.close() in the lightbox page code but it wasn’t doing anything! I tried so many different ways but none worked for me. So now what i did is i got the countdown timer from the apps and bought the premium thinking that i can edit the repeat and a close button in this app but it was useless too. Any ideas on what to do ?

Thanks for the help.

Update:

What i did is in the countdown timer app i got the button to work after the time runs out but the thing is that i linked it to a page in my website because i couldn’t code it to close lightbox and i am fine with that! My problem now is i can’t get it to repeat for everyday unless i remove the button

If I get it the way it is, messaging between html element and Wix Code will help.
More info here: Velo: Working with the HTML iframe Element | Help Center | Wix.com

  • in Messaging section

Hi anna,

Thank you for replying to my messages! So after i read the thread i understood that i can’t code the button in the html component from the lightbox code editor so i need to code it inside the html but i am fine by that. I tried it before but i didn’t have the right code for it, so i read that for sending a message from the html to the page i need this ( function button_click() { window.parent.postMessage(document.getElementById(“theMessage”).value, “*”); } )
but my action is to close the lightbox, so what’s the code for that? is it: ( function button_click() { wixwindow.lightbox.close(); } ) ? because as i said it didn’t work when i tried it

This is my code:

p, span { text-align: center; font-size: 60px; margin-top:0px; color: white; }

Only left!

CloseME

didn’t work

Hi I am currently trying to do something very similar to this. Did you ever figure out a way to make it work ?