window width jquery code example

Example 1: get the size of the browser jquery

$(window).height();
$(window).width();

Example 2: detecting screen width in jquery

var windowsize = $(window).width();

$(window).resize(function() {
  var windowsize = $(window).width();
});

if (windowsize > 440) {
  //if the window is greater than 440px wide then turn on jScrollPane..
    $('#pane1').jScrollPane({
       scrollbarWidth:15, 
       scrollbarMargin:52
    });
}

Example 3: get page resolution jquery

$( window ).width()

Example 4: jquery set width

$(".example").width("px");

Example 5: jquery element width

// Returns width of HTML document
$( document ).width();