Pagebeforeshow not fired on second time change Page event

微笑、不失礼 提交于 2019-12-12 01:57:20

问题


In Jquery mobile-1.1.1 pagebeforechange, pagebeforeshow events not fired second time call of $mobile.changepage.

From Home page:

function scan() {
        window.plugins.barcodeScanner.scan(function(result) {
                alert("Barcode-->"+result.text);
            barcode=result.text;
            $.mobile.changePage("scan.html",{reloadPage:true,transition: "none"});
        }, function(error) {
            alert("Scanning failed: " + error);
        });
}

Page Load:

$("#scan_page").live("pagebeforeshow",function(event){
        alert("Scan page Init");
            loadScannedItems();
});

function loadScannedItems()
{
    //append scanned items to list
    // called Scan() again
}

pagebeforeshow event fired first time the page loads,again I go to scan function call the changePage, but pagebeforeshow not fired. What is the problem in this code?

Also created button with data-role="button" dynamically. But still it displayed as link?

来源:https://stackoverflow.com/questions/12005305/pagebeforeshow-not-fired-on-second-time-change-page-event

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