Computer Science, asked by pavandolas7612, 11 months ago

What is cross-browser window resize events in JavaScript?

Answers

Answered by iiiii12
0

Example

<!DOCTYPE html>

<html>

<head>

<style>

div {

margin-top: 10px;

padding: 10px;

background-color: #1E9E5D;

width: 50%;

} span {

font-size: 50px;

}

</style>

<script>

window.addEventListener('resize', display);

function display() {

document.querySelector('.width').innerText = document.documentElement.clientWidth;

document.querySelector('.height').innerText = document.documentElement.clientHeight;

}

display();

</script>

</head>

<div>

<span>Width= <span class="width"></span></span><br />

<span>Height= <span class="height"></span></span>

</div>

</body>

</html>

Similar questions