Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
CopperCube and JQuery

slagusev
Registered User
Quote
2018-09-05 08:35:20

Hello!
I'm trying to embed jQuery UI in a project in HTML5.
Added 2D Overlay and put on the event click on it "Execute JavaScript", such code.
In the debugger, you can see that it adds elements, but the canvas itself stops responding to events (freezes)
Code:

var head = document.getElementsByTagName("head")[0];
link = document.createElement('link');
/*link. = function() {
// jQuery is available now
};*/
link.rel = 'stylesheet';
link.href = 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css';
head.appendChild(link);

script1 = document.createElement('script');
/*script1. = function() {
// jQuery is available now
};*/
script1.type = 'text/javascript';
script1.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js';
document.body.appendChild(script1);

script2 = document.createElement('script');
/*script2. = function() {
// jQuery is available now
};*/
script2.type = 'text/javascript';
script2.src = 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js';
document.body.appendChild(script2);



karmacomposer
Registered User
Quote
2018-09-05 20:45:19

Niko will have to answer this but I am not sure if Coppercube can compile Jquery.

Mike


ishmaru
Guest
Quote
2018-09-05 21:48:42

So jQuery is just a JavaScript libary so in theory its possible if you coppy and paste the entire jQuery code into your js file. But honestly jQuery is mostly for dom manipulation and Ajax calls all of which coppercube already has an api (and unless its a webgl then dom manipulation doesent work anyways) so especially for such a small code snippet I wouldn't think it's worth it.

In your case it sounds like your trying to embed an html 5 canvas in a can 2d overlay. This will not work as coppercube engine is not a browser.


slagusev
Registered User
Quote
2018-09-05 22:30:05

Example:
http://sgusev.esy.es/ccb/jquery....

I'm trying to dynamically add libraries so that I can add GUI elements later.

Open the page and see what he meant. First, check the camera (everything works here, that is, you can look in different directions)
Next, you can open the Developer Console and see the page code.

Then click on 2D Overlay and now try to look around. Does not work.
In the console to the page, libraries are added.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "I?ternational" (you are not logged in)


Text:

 

  

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


   






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