JQuery mobile - 内容导航在纵向按钮上折叠
We are developing an application with the layout near to the jqm examples here( table of contents on left and contents at right) but we want the same behavior as Sencha mobile, when it's in portrait, the table of contents collapses in a navigation button here
Is it possible to do with jqm?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我创建了一个示例 jQuery Mobile 应用程序,其工作方式如下 - 当处于纵向模式时,将显示分割视图布局。当处于横向模式时,可以通过标题中的按钮完成导航。为了在桌面浏览器中说明这一点,我已将
width
指定为500px
。如果width>500 px
,则拆分视图。如果宽度<500px
,按钮位于标题中。这是源代码:
这不是一个万无一失的应用程序。只是一个粗略的副本,用于说明如何完成此功能。要使此功能完美运行,还有很多事情要做。
为了使其工作,我使用了
媒体查询
的概念。使用它,您可以根据浏览器宽度(设备的方向)有选择地隐藏/显示布局。PS 我在这个例子中使用了
jqm-docs.css
。这个css还有其他媒体查询也针对其他宽度。所以当你测试这个时可能会出现一些奇怪的布局问题代码。请修改该 CSS 以删除不需要的媒体查询。如果有帮助请告诉我
I have created a sample jQuery Mobile application which works like this - When in portrait mode,a split view layout will be shown.When in landscape mode,navigation can be done via a button in the header.For illustrating this in a desktop browser,I have given the
width
to check as500px
.Ifwidth>500 px
,split view. Ifwidth <500px
, button in header.This is the source code:
This is not a foolproof application.But just a rough copy to illustrate how this feature can be done.There are still lot of things to be done to make this work perfectly.
To make it work I have used the concept of
media queries
.Using it you can selectively hide/show the layout depending on the browser width(orientation of device).P.S. I have used
jqm-docs.css
for this example.This css has other media queries too targeting other widths.So there might be some weird layout issues when you test this code.Please modify that css to remove the unwanted media queries.Let me know if it helps