var w = window.innerWidth;
var h = window.innerHeight;
No need for jquery.
UPDATED for eventlistener:
if(window.attachEvent) {
window.attachEvent('onresize', function() {
alert('attachEvent - resize');
});
}
else if(window.addEventListener) {
window.addEventListener('resize', function() {
console.log('addEventListener - resize');
}, true);
}
else {
//The browser does not support Javascript event binding
}
0
solved jQuery read window width