How to get the width of the screen and make a condition. If the screen width (in px) is less than 600, then do not run the script.

  • window.onresize = function (e) {console.log(e.target.outerWidth, e.target.outerHeight)}

1 answer 1

Not sure what I understand exactly what you want so I will give 2 links

screen width window.screen.width

browser window width window.innerWidth

  if( window.innerWidth >= 600 ){ //выполнять } else { //не выполнять }