Currently in the process of developing a Webapp utilizing Cesium and Bootstrap.
The issue at hand is that the Cesium viewer does not seem to be resizable. The only solution I have come across is using overflow: hidden;
in the CSS to limit it to 50% of the window size. However, this workaround can result in unnecessary resource consumption as we are essentially applying a band-aid fix.
Does anyone have any suggestions on how to resize the Cesium viewer without resorting to such measures?
var cesiumContainer = document.getElementById("cesiumContainer");
var ellipsoid = Cesium.Ellipsoid.WGS84;
var viewer = new Cesium.Viewer("cesiumContainer", {
sceneMode: Cesium.SceneMode.SCENE3D,
infoBox: false,
geocoder: false,
timeline: false,
animation: false,
homeButton: false,
scene3DOnly: true,
baseLayerPicker: false,
sceneModePicker: false,
fullscreenButton: false,
projectionPicker: false,
selectionIndicator: false,
navigationHelpButton: false,
navigationInstructionsInitiallyVisible: false
});
html,
body,
#cesiumContainer {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!DOCTYPE html>
<html lang='en'>
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="http://cesiumjs.org/releases/1.11/Build/Cesium/Widgets/widgets.css">
<script src="http://cesiumjs.org/releases/1.11/Build/Cesium/Cesium.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<div class="container-fluid">
<div id="cesiumContainer"></div>
<div class="col">
This section must occupy 50% of the total height.
</div>
</div>
</body>
</html>