简体   繁体   English

为什么Jquery移动设备在桌面浏览器上显示移动友好外观?

[英]Why does Jquery mobile display mobile friendly look on desktop browser?

I am trying to understand Jquery mobile. 我想了解Jquery mobile。 I am just referring the demos and viewing it from my desktop browser (Chrome) 我只是引用演示并从我的桌面浏览器(Chrome)中查看它

This is the demo link: 这是演示链接:

http://jquerymobile.com/demos/1.1.1/docs/forms/switch/ http://jquerymobile.com/demos/1.1.1/docs/forms/switch/

My question is why does the select look like it is being viewed in Ipad or something? 我的问题是为什么选择看起来像在Ipad或其他东西? I want the Jquery mobile to only come into action when being viewed from mobile devices. 我希望Jquery移动设备仅在从移动设备上查看时才能生效。 I don't want this style to be shown on my desktop computer. 我不希望这种风格显示在我的台式计算机上。 On desktop computer a select should look simple select with options and on mobile it should look more like what is being shown in demo (flip-flop). 在台式计算机上, select应该看起来很简单, options和在移动设备上看起来应该更像是演示(触发器)中显示的内容。

Can I achieve that with Jquery mobile? 我可以用Jquery mobile实现吗?

You need some kind of device recognition and routing engine for this. 你需要某种设备识别和路由引擎。 It doesn't really have anything to do with jQuery mobile, but rather with what backend framework you use. 它与jQuery mobile没有任何关系,而是与你使用的后端框架有关。 When I used MVC3 and jQuery mobile, I purchased 51degrees.mobi database, and then based on result of the user agent recognition I would serve different views to the user. 当我使用MVC3和jQuery mobile时,我购买了51degrees.mobi数据库,然后根据用户代理识别的结果,我会向用户提供不同的视图。 I hope this helps. 我希望这有帮助。

EDIT 编辑

I think you can use 51degrees.mobi database with all asp.net projects. 我想你可以在所有asp.net项目中使用51degrees.mobi数据库。 Basically it adds more data to Request.Browser, and then you can redirect user to either different URL or a subdomain like m.yoursite.com 基本上它会向Request.Browser添加更多数据,然后您可以将用户重定向到不同的URL或子域,如m.yoursite.com

if(Request.Browser["IsTablet"] == 'true' || Request.Browser["IsMobile"] == 'true')
{
    //redirect here
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM