问题
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