the <body>
<div id="starmap"></div>
<div class="btn" id="btn"></div>
<script src="stuquery.min.js"></script>
<script src="virtualsky.min.js"></script>
the <script>
S(document).ready(function() {
var planetarium = S. virtualsky({
id: 'starmap',
projection: 'stereo',
latitude: 34.4326,
longitude: -119.86286
});
});
document.getElementById('btn').onclick = function() {
document.getElementById('starmap').classList.add('box--large');
};
</script>
</body>
resize
to the window
after the added or removed class box--large
document.getElementById('btn').onclick = function() {
document.getElementById('starmap').classList.add('box--large');
window.dispatchEvent(new Event('resize'));
};
canvas#starmap_inner {
width: 100% !important;
height: 100% !important;
}
Find more questions by tags JavaScript