如何隐藏jQuery Mobile的标签(导航栏)设备背面的功能? [英] How to hide device back functionality in jquery mobile tab (navbar)?
问题描述
我开发jQuery Mobile的标签到我的网页。如果有5个标签页我的网页,现在我在第三个标签。我想它,这样,当我preSS来自移动后退按钮,它会自动重定向到第2和第一个标签。然后,它应该重定向到像另一个html页面我的主页。
当我preSS从设备返回按钮,它会自动重定向到我的主页不是previous标签页。如何在jQuery Mobile的控制?请只做那些需要的。先谢谢了。
您要听导航
事件,并检查的回的按钮是$ p $从的数据pssed 的对象 data.state.direction
。如果为true, $。mobile.changePage()
来的首页的
如果你使用jQuery Mobile的1.4, $ mobile.pageContiner.pagecontainer(变,#page);
$(窗口)。在(导航功能(事件数据){
如果(data.state.direction ==回){
$ .mobile.changePage(#网页);
返回false; / * prevent显示previous页* /
}
});
块引用>I have developed jquery mobile tab to my page. If my page having 5 tabs, now I'm in 3rd tab. I would like it so that when I press the back button from mobile, it should automatically redirect to the 2nd and 1st tab. Then it should redirect to my home page like another html page.
When I press the back button from device, it'll automatically redirect to my home page not a previous tab page. How to control in jquery mobile? Please do the needful. Thanks in advance.
解决方案You need to listen to
navigate
event and check if back button was pressed from data objectdata.state.direction
. If true,$.mobile.changePage()
to homepage.If you're using jQuery Mobile 1.4,
$.mobile.pageContiner.pagecontainer("change", "#page");
$(window).on("navigate", function (event, data) { if (data.state.direction == "back") { $.mobile.changePage("#homepage"); return false; /* prevent showing previous page */ } });
这篇关于如何隐藏jQuery Mobile的标签(导航栏)设备背面的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!