Cesium Infobox Description ID click event

Hi Guys,

Can’t we handle cesium infobox description id click events like in this example:
I am trying to set another camera angle when a link/ id is clicked which is specified as entity description:

Thanks,

@omar any thoughts if this can be handled like i am trying?

I handled the error as following, but el id is null when checked in console so the click event is not firing :

var viewer = new Cesium.Viewer(“cesiumContainer”, {
selectionIndicator: false,
infoBox: true,
});
var baseLayerPickerViewModel = viewer.baseLayerPicker.viewModel;
baseLayerPickerViewModel.selectedImagery = baseLayerPickerViewModel.imageryProviderViewModels[2];
Cesium.Label.enableRightToLeftDetection = true;
viewer.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(-87.64, 41.88, 1300)
});

var blueBox = viewer.entities.add({
name: “Blue box”,
description: “

Click Me

”,
position: Cesium.Cartesian3.fromDegrees(-87.64, 41.88, 750),
box: {
dimensions: new Cesium.Cartesian3(400.0, 300.0, 150.0),
material: Cesium.Color.BLUE,
},
});

viewer.zoomTo(viewer.entities);

var el = document.getElementById(‘p_id’);
if(el){
//el.addEventListener(‘click’, swapper, false, function (e)

el.addEventListener(“click”, function (e)
{
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(-85.64, 41.88, 750),
orientation : {
heading : Cesium.Math.toRadians(175.0),
pitch : Cesium.Math.toRadians(-35.0),
roll : 0.0
}
});
});

}

The content of the Infobox is inside an iframe, so I think you won’t be able to get it from the external document like this. I think you’ll either need to place the JavaScript code inside the content of the Infobox itself, or replace CesiumJS’s infobox with your own HTML overlay that you can freely customize.

Thanks Omar.

I was able to figure it out by add external pie chart on my application visible on entity click.