如果是移动设备,如何不运行功能?
我的网站上有一个模态弹出功能,但如果浏览器小于 480px,我不希望它运行。我发现,如果我放置一个 if 语句,例如:
if (window.innerWidth && window.innerWidth > 480) {
run function()
}
那么它应该仅在浏览器的 innerWidth > 时运行480.然而它不起作用,我认为这是因为我在这个网站上有页面缩放。如果页面缩放已打开,任何人都可以帮助我使用条件语句吗?谢谢。
I have a modal pop up function on my website, but i don't want this to run if the browser is smaller than 480px. I have found that if I put an if statement such as:
if (window.innerWidth && window.innerWidth > 480) {
run function()
}
Then it should run only if the browsers innerWidth is > 480. However its not working and I think its because I have page scaling on this website. Can any one help me with a conditional statement if page scaling is on? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经想通了。
I have figured it out.