js detect screen size change 1

js detect screen size change

window.onresize = function(){
console.log("resize");
}

Here is what the above code is Doing:
1. We’re creating a function called “resize”
2. We’re telling the browser to run the function “resize” whenever the window is resized
3. We’re telling the browser to print “resize” to the console whenever the window is resized

Now, let’s add a line of code to the function that will change the size of the box.

Similar Posts