Answers for "javascript if window size is less than"

10

jquery check if screen size

if ($(window).width() < 960) {
   alert('Less than 960');
}
else {
   alert('More than 960');
}
Posted by: Guest on February-26-2020
0

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")
  }
})
Posted by: Guest on May-02-2021

Code answers related to "javascript if window size is less than"

Code answers related to "Javascript"

Browse Popular Code Answers by Language