I'd like to get the native screen width on a device to append scripts in the DOM. Is it possible using jQuery ?
Thanks
I'd like to get the native screen width on a device to append scripts in the DOM. Is it possible using jQuery ?
Thanks
window.screen.width
? Source: https://developer.mozilla.org/en-US/docs/DOM/window.screen
Sure. You can get the basic width and height using:
screen.width;
screen.height;
If required, you can also get the pixel ratio (useful if you need to also detect retina displays) by using:
window.devicePixelRatio
You can set the width to device width with a css property:
width: device-width;