乐观使你倾向于幸福健康事业顺利,悲观使你倾向于绝望患病失败忧郁孤独懦怯——民谚

代码如下

1
2
3
4
5
$(window).resize(() => {
var height = $(window).height();
var width = $(window).width();
console.log(height+" "+width)
});

image-20210519231250416

然后当我窗口大小发生变化时就会触发

image-20210519231351976