jquery mobile alter、confirm重写,使用popup
function confirmDialog(text, callback) { var popupDialogId = ‘popupDialog‘; $(‘<div data-role="popup" id="‘ + popupDialogId + ‘" data-confirmed="no" data-transition="pop" data-overlay-theme="b" data-theme="b" data-dismissible="false" style="max-width:500px;"> <div data-role="header" data-theme="a"> <h1>Question</h1> </div> <div role="main" class="ui-content"> <h3 class="ui-title">‘ + text + ‘</h3> <a href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-btn-b optionConfirm" data-rel="back">Yes</a> <a href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-btn-b optionCancel" data-rel="back" data-transition="flow">No</a> </div> </div>‘) .appendTo($.mobile.pageContainer); var popupDialogObj = $(‘#‘ + popupDialogId); popupDialogObj.trigger(‘create‘); popupDialogObj.popup({ afterclose: function (event, ui) { popupDialogObj.find(".optionConfirm").first().off(‘click‘); var isConfirmed = popupDialogObj.attr(‘data-confirmed‘) === ‘yes‘ ? true : false; $(event.target).remove(); if (isConfirmed && callback) { callback(); } } }); popupDialogObj.popup(‘open‘); popupDialogObj.find(".optionConfirm").first().on(‘click‘, function () { popupDialogObj.attr(‘data-confirmed‘, ‘yes‘); }); }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。