I would like to use a Panel in a jqm site for my Choose Language component. So that component will need to be present on every page. Here is the setup for a single-page pane
Your best course of action is to dynamically create a panel for every page.
I made you a working example: http://jsfiddle.net/Gajotres/pZzrk/
$(document).on('pagebeforeshow', '[data-role="page"]', function(){ $('').attr({'id':'mypanel','data-role':'panel'}).appendTo($(this)); $('').attr({'id':'test-btn','data-role':'button'}).html('Click me').appendTo('mypanel'); $.mobile.activePage.find('#mypanel').panel(); $(document).on('click', '#open-panel', function(){ $.mobile.activePage.find('#mypanel').panel("open"); }); }); Few descriptions: $.mobile.activePage is needed because we will have same panel in every page, and all of them will have same id. If we open it without active page we will open its first occurrence inside the DOM. jQuery Mobile developers have stated that in next major version panel widget will no longer need to be part of a page, instead it will be placed in a same level as a page div. So one panel will ne needed. Unfortunately you will need to dynamically create it. 0 讨论(0) 查看其它11个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
Few descriptions:
jQuery Mobile developers have stated that in next major version panel widget will no longer need to be part of a page, instead it will be placed in a same level as a page div. So one panel will ne needed. Unfortunately you will need to dynamically create it.