10 examples of 'detect screen size jquery' in JavaScript

Every line of 'detect screen size jquery' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
41function get_screen_size()
42 {
43 var w=document.documentElement.clientWidth;
44 var h=document.documentElement.clientHeight;
45 return Array(w,h);
46 }
23function screenHeight()
24{
25 return $(window).height();
26}
47function GetViewportSize() {
48 var viewportwidth;
49 var viewportheight;
50
51 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
52 if (typeof window.innerWidth != 'undefined') {
53 viewportwidth = parseFloat(window.innerWidth);
54 viewportheight = parseFloat(window.innerHeight);
55 }
56
57 // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
58 else if (typeof document.documentElement != 'undefined'
59 && typeof document.documentElement.clientWidth !=
60 'undefined' && document.documentElement.clientWidth != 0) {
61 viewportwidth = parseFloat(document.documentElement.clientWidth);
62 viewportheight = parseFloat(document.documentElement.clientHeight);
63 }
64 // older versions of IE
65 else {
66 viewportwidth = parseFloat(document.getElementsByTagName('body')[0].clientWidth);
67 viewportheight = parseFloat(document.getElementsByTagName('body')[0].clientHeight);
68 }
69 return [viewportwidth, viewportheight];
70}
109isDesktopScreenSize(specs = null) {
110 return !this.isMobileScreenSize(specs);
111}
43export function getScreenSize() {
44 const width = window.innerWidth
45 switch (true) {
46 case (width < 760):
47 return 'mobile'
48 case (width < 1025):
49 return 'laptop'
50 case (width < 1200):
51 return 'desktop'
52 default:
53 return 'wide-desktop'
54 }
55}
240function detectMobile(){ //tries to detect if user is using a mobile device
241
242 if(screen.width <= 900){
243 console.log("mobile device detected...adjusting board size and layout");
244 document.getElementById("chatleft").style.display = "none";
245 }
246}
5function getWindowSize(dim) {
6 var myWidth = 0, myHeight = 0;
7 if (typeof (window.innerWidth) == 'number') {
8 // Non-IE
9 myWidth = window.innerWidth;
10 myHeight = window.innerHeight;
11 } else if (document.documentElement
12 && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
13 // IE 6+ in 'standards compliant mode'
14 myWidth = document.documentElement.clientWidth;
15 myHeight = document.documentElement.clientHeight;
16 } else if (document.body
17 && (document.body.clientWidth || document.body.clientHeight)) {
18 // IE 4 compatible
19 myWidth = document.body.clientWidth;
20 myHeight = document.body.clientHeight;
21 }
22 // window.alert( 'Width = ' + myWidth );
23 // window.alert( 'Height = ' + myHeight );
24
25 if (dim == "height")
26 return myHeight;
27 else
28 return myWidth;
29}
51function isMobile() {
52 //var size = window.getComputedStyle(document.body,':after').getPropertyValue('content');
53 //return size.indexOf("mobile") !=-1;
54 return $(window).width() < 767;
55}
135function isMobile(){
136 return $(window).width() <= 600;
137}
16isLargeScreen() {
17 if (
18 $(this._window).width() >= this._config.largeScreenMinWidth &&
19 $(this._window).height() >= this._config.largeScreenMinHeight
20 ) {
21 return true;
22 }
23
24 return false;
25}

Related snippets