Open Shange-Fagan opened 1 year ago
@Shange-Fagan I believe the issue is that you're setting the innerHTML
of your element to a script object. The innerHTML
attribute should be set to a string instead, as you can see here: https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML
@Shange-Fagan I believe the issue is that you're setting the
innerHTML
of your element to a script object. TheinnerHTML
attribute should be set to a string instead, as you can see here: https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML
What do I set if I don't want it to be a string? what if I want to display a html page instead of a marker?
@Shange-Fagan you can set the content to any html you like. It's just that if you populate your elements using innerHTML
, the assignment needs to be a string. This is not globe.gl specific, it's standard Javascript.
But essentially, you can include any html content you'd like in those items.
I have tried populating the html element using
.htmlElement(d => {my_awesome_script});
and
.htmlElement(my_awesome_script)
but with no success, does it not work if the content of the html element is a url? for example my_awesome_script is simply:
var my_awesome_script = document.createElement('script');
my_awesome_script.setAttribute('src','https://widget.rss.app/v1/wall.js');
my_awesome_script.async = true;
my_awesome_script.style.display = "flex";
Edit: still trying to no success, seems weird because I have followed all the instructions for properly embedding the news feed and setting the content of my htmlElemement yet I am unable to get the content to display
I was thinking maybe if I set the background to transparent the widget will appear on the globe is there something wrong with this code?:
<head>
<style> body { margin: 0; } </style>
<script src="//unpkg.com/globe.gl"></script>
<!-- <script src="../../dist/globe.gl.js"></script>-->
</head>
<body>
<div id="globeViz"></div>
<rssapp-wall id="tszZCksFzEB4w9UN"></rssapp-wall>
<script>
var my_awesome_script = document.createElement('script');
my_awesome_script.type = 'text/javascript';
my_awesome_script.async = true;
my_awesome_script.setAttribute('src','https://widget.rss.app/v1/wall.js');
my_awesome_script.style.background = 'transparent';
my_awesome_script.style.position = 'static';
// Gen random data
const N = 30;
const gData = [...Array(N).keys()].map(() => ({
lat: 54, //latitude and longitude for london
lng: -2,
width: (24),
height: (30),
}));
const elem = document.getElementById('globeViz');
Globe()
.globeImageUrl('//unpkg.com/three-globe/example/img/earth-dark.jpg')
.htmlElementsData(gData)
.htmlElement(d => {
return my_awesome_script
})
(elem);
</script>
</body>
I want to create a webpage that displays html news widgets on a globe, I have the globe and I have the html news widget but I don't know how to implement the widget into the code so that it displays on the globe.
the globe I have so far:
the widget:
the embed:
my code:
currently with the code like this I am getting no errors but as you can see the news widget is not being displayed, any advice on how I can make this thing work?