Basic question on displaying plain text

I’m new to CesiumJS (and Javascript in general), and need a pointer on something really basic.

I’m trying to recreate a simple Cesium Ion story in CesiumJS. The final product will be simple: a KML file with locations (already figured out how to do that), and a dropdown list with several options. The first option will call up a text box (as appears on the Cesium Ion Stories), and the others will call up CZML files.

I think I can copy the code for the dropdown list from the “Terrain” or “KML” examples in the sandcastle library, and combine that with code from the “CZML” example to call up those files from my assets.

The main thing I’m struggling with is the text/infobox. What widget do I use to display plain text on the Cesium canvas (i.e. not tied to a location on the globe), preferably without grabbing the text from an external file?

Hello, I think you want to show a little label when hover or click on Cesium viewer?

You could create a div and set it position to absolute or fixed, when you pick something, you could show and translate it to the right postion with some offset. Below is a offical example about 3dtiles next, but you could only pay attention to the picking part (Start from line 160).

You could learn more about Scene.pick() and ScreenSpaceEventHandler.

1 Like

Thanks @Gu-Miao!!