Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript check less width of window

window.addEventListener("resize", function() {
  if (window.matchMedia("(min-width: 500px)").matches) {
    console.log("Screen width is at least 500px")
  } else {
    console.log("Screen less than 500px")
  }
})
Source by techstacker.com #
 
PREVIOUS NEXT
Tagged: #javascript #check #width #window
ADD COMMENT
Topic
Name
9+5 =