简体   繁体   English

JQuery移动面板,点击返回重定向到上一页,而不是折叠面板

[英]JQuery mobile panel, click on go back is redirecting to previous page, not collapsing the panel

When the “panel” is enabled and then I click on the back button of the mobile device, I am redirected to the previous page, rather than the "panel" being hidden. 当启用“面板”然后我单击移动设备的后退按钮时,我被重定向到上一页,而不是隐藏“面板”。 How do I make the back button hide the panel? 如何使后退按钮隐藏面板?

Use .panel('close') when you click on back button. 单击后退按钮时使用.panel('close') Give it an ID and use the code below. 给它一个ID并使用下面的代码。

Demo 演示

$(document).on('click', '#close', function () {
 $('#panel-ID').panel('close');
});

You can simply give a back button on the panel which doesn't even need a script to be written for it or otherwise if we tap or click anywhere other on the screen besides the panel area, the would disappear easily. 您可以简单地在面板上给出一个甚至不需要为其编写脚本的后退按钮,否则如果我们点击或点击除面板区域之外的屏幕上的任何其他位置,则会很容易消失。 Check the file on this link for reference. 检查此链接上的文件以供参考。 http://www.2shared.com/document/KyJI_PiF/fiddle.html http://www.2shared.com/document/KyJI_PiF/fiddle.html

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

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