Hi, I'm now faced with another issue.
Besides the CSS, I have also tried injecting scripts into the iframe:
A. jquery
B. my own script.
Initially, I coded it this way:
setTimeout(function() {
var script = document.createElement(“script”);
script.src = Cesium.buildModuleUrl(‘https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js’);
script.type = “text/javascript”;
viewer.infoBox.frame.contentDocument.head.appendChild(script);
var myscript = document.createElement("script");
myscript.src = Cesium.buildModuleUrl('/Apps/hide-show.js');
myscript.type = "text/javascript";
viewer.infoBox.frame.contentDocument.head.appendChild(myscript);
}, 5000);
The issue with this is that for some reason, the jquery.min.js will load into the iframe AFTER the hide-show.js
It will then throw me an error:
ReferenceError: $ is not defined
Therefore I coded it this way to get rid of the error by having the jquery to load first before the hide-show.js:
****NOTE: I don't know if this is the proper way to do it, but if there is any other solution, please let me know!*****
setTimeout(function() {
var script = document.createElement(“script”);
script.src = Cesium.buildModuleUrl(‘https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js’);
script.type = “text/javascript”;
viewer.infoBox.frame.contentDocument.head.appendChild(script);
}, 5000);
setTimeout (function() {
var myscript = document.createElement(“script”);
myscript.src = Cesium.buildModuleUrl(’/Apps/hide-show.js’);
myscript.type = “text/javascript”;
viewer.infoBox.frame.contentDocument.head.appendChild(myscript);
}, 6000);
While I was able to get rid of the first problem, I faced with another.
I have a JSON array of data:
var ListArray = [{"time":"1409340564","latdec.dst":"37.4192","longdec.dst":"-122.057","org.dst":"Google","domain.dst":"1e100.net","latdec.src":"1.3592","longdec.src":"103.9894"}, {"time":"1409340567","latdec.dst":"37.4192","longdec.dst":"-122.057","org.dst":"Google","domain.dst":"1e100.net","latdec.src":"2.0000","longdec.src":"47.0000"}];
So I have a for loop after setting the timeout for the scripts and created my polyline entity with descriptions inside it so that there will be two lines coming from the source location and going towards the destination location.
The scripts that I injected into the iframe earlier will work for one polyline entity, and not the other.
Polyline 1 (Work) - Polyline 2 (Won't work) - Polyline 1 (won't work anymore)
It's a really weird issue, but I hope someone can point out what's wrong with it!
Thank you.
Trialea