jquery - Do something if screen width is less than 960 px -


how can make jquery if screen width less 960 pixels? code below fires 2nd alert, regardless of window size:

if (screen.width < 960) {     alert('less 960'); } else {      alert('more 960'); } 

use jquery width of window.

if ($(window).width() < 960) {    alert('less 960'); } else {    alert('more 960'); } 

Comments

Popular posts from this blog

Python __call__ special method practical example -

How can I edit my VIM config so that Vim treats ".ejs" files the same as it currently treats my html files? -