jQuery-mobile 1.3 Panel always visible

社会主义新天地 提交于 2019-12-04 14:30:20

问题


In the new jQuery-mobile 1.3 version how can be added a left panel that always be visible from the start?

This panel will be act as a navigation menu.

Thanks


回答1:


You can open it programatically like this:

$(document).on('pagebeforeshow', '#index', function(){       
    $( "#mypanel" ).panel( "open");
});

And here's a working jsFiddle example: http://jsfiddle.net/Gajotres/EkbYe/




回答2:


There's some things that mess up when using panels as menubar. (yet) If you open the panel this way, it will not work flawless in devices with small widths. It will work, but it's strange cause part of the page is off the screen and has no horizontal scroll. There's no way to navigate in a cellphone with the panel opened and locked as a menubar. (I'm supposing you do not want to use buttons to open and close the panel!) Maybe your target users are only in desktop or larger screen devices. In this case u can use this code, plus data-dismissible="false" AND data-swipe-close="false" in panel tag. But still there's a problem: the ESC key. If the user press the ESC key, the panel will close, and if u have no buttons to open it again, the menu blows! I havent found a way to use panel as menubar yet. If someone did, please help us!



来源:https://stackoverflow.com/questions/14762831/jquery-mobile-1-3-panel-always-visible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!