用户's屏幕's高度&要保存在变量中的宽度

user 's screen's height & width to be saved in variables

本文关键字:变量 存在 amp 屏幕 高度 用户 保存      更新时间:2023-12-05

我们可以复制高度&***等变量中的查看器或用户的屏幕宽度

var h=?
var w=?

var h=screen.height应该能做到。宽度相同。

类似的东西?

w = $(window).width(); //get current window width
h = $(window).height(); //get current window height

jQuery方式:

//page load
var windowW = $(window).width();
var windowH = $(window).height();
//window size change
$(window).resize(function() {
    windowW = $(window).width();
    windowH = $(window).height();
});

您到底想要什么?

var h = screen.height,
w = screen.width;