webgl-earth
webgl-earth copied to clipboard
Is there a way of adding markers or links to this?
I have used and credited you for helping me produce a peace of work for my web design class, so thank you.
I would like to add points on the globe which users can click to navigate to my websites other pages. I was hoping you new a way I could do this?
var marker = WE.marker([51.5, -0.09]).addTo(earth);
marker.bindPopup("<b>Hello world!</b><br>I am a popup.<br /><span style='font-size:10px;color:#999'>Tip: Another popup is hidden in Cairo..</span>", {maxWidth: 150, closeButton: true}).openPopup();
var marker2 = WE.marker([30.058056, 31.228889]).addTo(earth);
marker2.bindPopup("<b>Cairo</b><br>Yay, you found me!", {maxWidth: 120, closeButton: false});
I have found this code but I do not believe it would work... I am wanting to have a website like; http://viewfromabove.emirates.com/3d
any suggestions would be great!!
If you do console.log(marker) you see that there is an element inside marker. You can treat this marker.element as any DOM element.
You could for example write:
marker.element.addEventListener('click',function(){
window.location = 'http://example.com/';
});