Say I have a container which height is calculated by it's width. Width changes dynamically base on the viewport width of the screen. I want to detect when the height has reached 70vh or any number and if the limit has reached I want to get it's width. That has to happen dynamically base on the viewport width and height. For instance, I load the page and the height has reached 70vh and when it reached 70vh, it's width is say 1072px. I want to do that dynamically. Does any one know any formula to do that??
Asked
Active
Viewed 241 times
-2
-
https://stackoverflow.com/questions/6492683/how-to-detect-divs-dimension-changed – sen Jun 06 '22 at 04:08
1 Answers
0
You can use this in your script file it will print your screen dimensions for you
const width = window.innerWidth || document.documentElement.clientWidth ||
document.body.clientWidth;
const height = window.innerHeight|| document.documentElement.clientHeight||
document.body.clientHeight;
console.log(width);
console.log(height)
document.write("The Height is " + height + "px ")
document.write("The width is  " + width + "px")

Usama
- 122
- 5