如何让我的Jquery脚本只在设备是移动设备时才能运行

时间:2022-08-01 07:14:33

I am thinking to build a JQuery mobile app for my domain. But I don't know How I can ensure it when domain is reached through computer or laptop then my regular site shows up. But when someone open up the site through Tablet or mobile phone then my JQuery app shows up?

我正在考虑为我的域构建一个JQuery移动应用程序。但我不知道如何通过计算机或笔记本电脑访问域名时我能确保它,然后我的常规站点出现。但是当有人通过平板电脑或手机打开网站时,我的JQuery应用程序会出现吗?

That JQuery mobile app is totally a different script.

那个JQuery移动应用程序完全是一个不同的脚本。

Can anyone tell me? Thanks in advance.

有人能告诉我吗?提前致谢。

1 个解决方案

#1


0  

You could maybe use css to do this:

您可以使用css来执行此操作:

@media (min-width: 320px) and (max-width: 568px){
    //what ever you want to hide
    body {
      display:none;
   }
}

And you must have meta tag to this work:

你必须有这个工作的元标记:

<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

#1


0  

You could maybe use css to do this:

您可以使用css来执行此操作:

@media (min-width: 320px) and (max-width: 568px){
    //what ever you want to hide
    body {
      display:none;
   }
}

And you must have meta tag to this work:

你必须有这个工作的元标记:

<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">