【发布时间】:2015-07-05 09:12:06
【问题描述】:
我最近做了一个 javascript 游戏,但是它拒绝在手机和 iPad 上运行...
有没有办法知道用户是否使用PC,以便我可以阻止移动用户尝试它?
【问题讨论】:
标签: web mobile responsive-design
我最近做了一个 javascript 游戏,但是它拒绝在手机和 iPad 上运行...
有没有办法知道用户是否使用PC,以便我可以阻止移动用户尝试它?
【问题讨论】:
标签: web mobile responsive-design
您可以将媒体查询用于响应式 UI,并查看以下代码:
// For Smartphone
if (window.innerWidth < 600)
{
// TODO-- for the SmartPhone
}
// For Tablet
else if(window.innerWidth > 600 && window.innerWidth < 768)
{
//TODO-- for the Tablet.
}
// For Desktop
else if(window.innerWidth > 768)
{
//TODO -- for the Desktop.
}
【讨论】: