In JavaScript, I'm telling the browser to do something if the window size is greater than 500px.(在JavaScript中,如果窗口大小大于500px,我要告诉浏览器执行某些操作。)
I do it like so:(我这样做是这样的:)
if (windowsize > 500) {
// do this
}
This works great, but I would like to apply this same method, but with a range of numbers.(这很好用,但是我想使用相同的方法,但是要有一定范围的数字。)
So I would like to tell my browser to do stuff if the window size is between 500px and 600px.(所以我想告诉我的浏览器在窗口大小介于500px和600px之间时做些什么。) I know this wouldn't work, but here is how I imagined it:(我知道这行不通,但是这是我的想象:)
if (windowsize > 500-600) {
// do this
}
Is this even possible, within JavaScript?(在JavaScript中甚至可能吗?)
ask by Dyck translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…