ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator Help with javascript popup
person icon
misterpaint
Registered User
Quote
2024-01-05 14:19:16

In the environment created in CopperCube, I would like to understand how to 'Approaching an object I can trigger the opening of an HTML/JavaScript popup that is embedded in the page's code where I have inserted the WebGL if this environment.
Is this possible?"

This code for the responsive popup:
https://codepen.io/Shaz3e/pen/jE...

emoji icon_smile thank you!

person icon
just_in_case
Moderator
Quote
2024-01-05 15:33:11

you can execute the function that is in the script for opening the popup and closing the popup.

in the provided script the code for opening and closing the popup is like this.



// Popup Open
function popupOpen() {
document.getElementById("popup").style.display = "block";
document.getElementById("overlay").style.display = "block";
}
// Popup Close
function popupClose() {
document.getElementById("popup").style.display = "none";
document.getElementById("overlay").style.display = "none";
}


so when you want to open the popup in your game, you can use the execute javascript command and can use
popupOpen()


to open the popup and do the same for closing the popup simply execute the
popupClose()


I believe it should work then, but you need to have the script in the same html page as of your coppercube game, and they both should not conflict with each other.

Coppercube uses a mininified JS code, so if you are using some other third party code, then chances are high that they both will conflict with each other.

you need to scope them individually in different functions if you think that they might conflict with each other.

person icon
writer
Guest
Quote
2024-02-09 19:18:16

just_in_case I did not know that, thanks!

person icon
writer
Guest
Quote
2024-02-09 19:23:41

just_in_case Is there a code for opening and closing a pop-up window in the exe file?

person icon
just_in_case
Moderator
Quote
2024-02-10 01:24:36

You can create popups with the help of 2D overlays, or planemeshes, and hide or unhide them, can also use scaling on them to create a popup effect in windows exe.


Note:- Don't post in all caps, or things that seems to be spam. Just removed your last two posts that was in all caps and a post that seemed spam.

person icon
misterpaint
Registered User
Quote
2024-02-15 08:51:15

thanks to all!
I managed to create the pop-ups using the idea suggested by just_in_case, and with the help of ChatGPT, I polished everything. It's perfect! I'm almost ready to launch the new graphical interface for my online gallery

Thank you just_in_case!


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |