How can I make jQuery do something if my screen width is less than 960 pixels? The code below always fires the 2nd alert, regardless of my window size:
if (screen.width < 960) { alert('Less than 960'); } else { alert('More than 960'); }
use
$(window).width()
or
$(document).width()
$('body').width()