Open a Lightbox when Chatbox is minimized

Hi!

I want to open a Lightbox after the Wix Chatbox is minimized.
I’ve tried with this:

$w( “#wixChat1” ).onMinimize(() => {
wixWindow.openLightbox( “MobileMenuCopy” );
});

Thank you in advance,

Carlos.

You will need to do this on the MASTER-PAGE.JS !!!

$w.onReady(function() {
    $w("#wixChat1").onMinimize(()=> {   
        wixWindow.openLightbox("MobileMenuCopy")
    })
})

And here you will find an alternative…

Thank you very much, Dima!

Now I understand, but now a new concern come to me…
Look, I want to trigger that event in a specific page only, but due it will be coded in the Master Page, I don’t even know if it is possible to only trigger it on the page I want it to happen.

Thank you!

@contacto49959
It is possible!
As you can see —> It is the MASTER-PAGE!
You just have to figure out how to get the right “CURRENT-PAGE”.

Do it like that…—> pseudo-code…(on/in MASTER-PAGE)

if(page5) {run my code for ChatBox}
else {do nothing}

This would only run on page-5.

Hello Dima!

Okay perfect!
Thank you very much! and sorry for my late response, I had a hard weekend!
I’m just starting to code and, each day, due by these advices, I’m improving!

Have an excellent week Dima! Take care,

Carlos.

Thanks! I hope you could solve your problem.
Have a good day.

Good luck and happy coding.

Hi again @russian-dima I apologize for my insistence, it’s just that I can’t make it work! Here’s a photo:

import wixWindow from ‘wix-window’ ;
import wixSite from ‘wix-site’ ;

$w.onReady( function () {
if (wixSite.currentPage === ‘page1’ ){
$w( “#wixChat1” ).onMinimize(()=> {
wixWindow.openLightbox( “MobileMenuCopy” );
})
} else {
//nothing
}
})

Could you tell me what I’m doing wrong?
Thank you in advance,

Carlos.

I checked this CODE…

$w.onReady(function() {
   let current = wixSite.currentPage.name;
   console.log(current)
   if(wixSite.currentPage.name === "Multi-Menu"){ 
         $w("#wixChat1").onMinimize(()=> {   
         wixWindow.openLightbox("MobileMenuCopy");
         })
    } 
    else {   }
}) 

…and it is working well.

I do not have a Lighbox with the ID—> “MobileMenuCopy”
So another Lightbox will be opened…see here…(just an example page with implementation of this code)…

https://www.media-junkie.com/multi-menu

Minimize the chat and see what happens.

Hi @russian-dima ! Thank you very much for your response and for the example that you did in your site!

I’ve al ready visited your site and saw the example, it works perfectly. Again, thank you for test it!
I just putted your code on the Master Page, but I don’t know why it marks me an error. It seems like the Master Page doesn’t catch the wixWindow module.

Look, here a pic:

This idea came form this:
I want the users to chat only in the “Mobile-Chatbox-Support” page. This because I don’t want to display the ChatBox icon (whether it’s on Desktop or Mobile) in every page.
So if the users REALLY want to chat with us, they would have to enter to the Mobile Chatbox Support page to do so.
When they finish chatting and click the “X” to close the chat, immediately the menu is displayed (my menu is a Lightbox).

Here’s the link if you want to take a look! The page is still in development. And here is a random access if it’s needed.

MAIL: user@ a1. com (it have spaces, due my account does not let me attach links)
PASS: usera1
preparatemexico. com/mobile-chatbox-support

Thank you again Dima, from Mexico!

I will take a look later, when i am home from work.:wink:

Thank you!

@contacto49959
Hmmmm, i do not know how you could place your Wix-Chat on a page, because when i am adding the Wix-Chat-App, it is automaticaly added to all pages.

AS you can see here…


…the imported window module on the master-page is working.

What is the ID of your chat? Perhaps wrong-ID ?
Your Lightbox is called —> “MobileMenuCopy” ?
Do you have created a Lightbox in your Wix-Editor?

Check every line in your code.
And what is the exact error-description in CONSOLE when using —> CHROME ?

Hi @russian-dima ! Hope you’re great!
I’ve checked my code carefully and letter by letter, It’s the same as yours and, it still not working. Also, I checked the wixChat and Lightbox ID’s, and they’re alright.

I opened the developer console in chrome as you told me, and these are the warnings:

and here the exact line of code:

Sincerely, I don’t understand almost nothing of these photos!

ACCORDING TO JUST SHOW THE WIX CHAT ON A SINGLE PAGE
To achieve this, I thought to set a conditional property “Collapse wixChat in every page except X”

Again, thank you for your time Dima, I really appreciate your help!

It’s important to mention that these all warnings appear when I click the wixChat to OPEN IT as well as to CLOSE IT.

Do yourself a favour. Create a blank page and test all the code on a new blank page and compare if the behaviour is still the same.