使Web应用程序与掌上电脑兼容

时间:2021-05-23 20:10:17

I'm developing a web app, with a full ajax ui using html, css and jquery as the js framework. All pages are developed for PC, but there are some pages that should work fine on Handheld (windows ce) as well. Along with css changes to make those pages compatible with handheld devices, there are little operational differences in js. i.e user does not select dates in handheld whilst they can on pc.

我正在开发一个Web应用程序,使用html,css和jquery作为js框架使用完整的ajax ui。所有页面都是为PC开发的,但也有一些页面可以在Handheld(windows ce)上正常工作。随着css的变化使这些页面与手持设备兼容,js的操作差异很小。即用户不能在掌上电脑中选择日期。

The question is, have can I make different pages for the handheld version? How can I develop compatible and ready pages only by applying another css file? Does @media help? Should i use jquery mobile? Can I detect the device using js and switch the css and some logic?

问题是,我可以为掌上电脑版制作不同的页面吗?如何仅通过应用另一个css文件来开发兼容和就绪页面? @media有帮助吗?我应该使用jquery mobile吗?我可以使用js检测设备并切换css和一些逻辑吗?

1 个解决方案

#1


1  

You should be able to use pure CSS and the media attribute of the <link> tag to control which stylesheet is loaded. This guy seems to have some nice cross-browser markup that will get you started.

您应该能够使用纯CSS和 标签的media属性来控制加载哪个样式表。这家伙似乎有一些很好的跨浏览器标记,可以帮助你入门。

Alternatively/additionally, consider using Modernizr to add classes to your root <html> node that tell you a lot of information about the capabilities of a user. Then you can do simple tests in Javascript to enable or disable certain features if certain functionality isn't present.

另外/另外,考虑使用Modernizr将类添加到根节点,该节点告诉您有关用户功能的大量信息。然后,您可以在Javascript中执行简单测试,以在某些功能不存在时启用或禁用某些功能。

#1


1  

You should be able to use pure CSS and the media attribute of the <link> tag to control which stylesheet is loaded. This guy seems to have some nice cross-browser markup that will get you started.

您应该能够使用纯CSS和 标签的media属性来控制加载哪个样式表。这家伙似乎有一些很好的跨浏览器标记,可以帮助你入门。

Alternatively/additionally, consider using Modernizr to add classes to your root <html> node that tell you a lot of information about the capabilities of a user. Then you can do simple tests in Javascript to enable or disable certain features if certain functionality isn't present.

另外/另外,考虑使用Modernizr将类添加到根节点,该节点告诉您有关用户功能的大量信息。然后,您可以在Javascript中执行简单测试,以在某些功能不存在时启用或禁用某些功能。