how to get window width in javascript All In One
how to get window width in javascript All In One
how to get window width in js
How to Detect Screen Resolution with JavaScript
window
https://developer.mozilla.org/en-US/docs/Web/API/window/innerWidth
https://www.w3schools.com/jsref/prop_win_innerheight.asp
window.innerWidth
&window.innerHeight
function innerFunction() {
var w = window.innerWidth;
var h = window.innerHeight;
document.getElementById("demo").innerHTML = "Width: " + w + "<br>Height: " + h;
}
function outerFunction() {
var w = window.outerWidth;
var h = window.outerHeight;
document.getElementById("demo").innerHTML = "Width: " + w + "<br>Height: " + h;
}
screen
window.screen.height;
window.screen.width;
viewport size / device size / document size
https://ryanve.com/lab/dimensions/
responsive viewport / viewbox
svg viewbox
small screen
const svgStr = `
<svg data-uuid="live_map_svg" id="live_map_svg" width="100%" height="100%" viewBox="0 0 1000 1000" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"></svg>
`;
body.insertAdjacentHTML(`beforeend`, svgStr.trim());
https://www.tutorialrepublic.com/faq/how-to-detect-screen-resolution-with-javascript.php
https://usefulangle.com/post/190/javascript-window-width-height
refs
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/12424229.html
未经授权禁止转载,违者必究!