我通过.js插入jQM弹出窗口小部件,如此...
// jQM popup settings injection
// the variable "g_html_popup_settings" contains the markup for the settings popup(s)
// this var is established in application.html.erb
// popup injection
$(document).on('pagebeforecreate', function () {
var popupDOM = $("[data-role=popup]").length;
if (popupDOM === 0) {
// using enhanceWithin() as it triggers an update in presentation
// for injected widgets
$.mobile.pageContainer.prepend(g_html_popup_settings).enhanceWithin();
// we use .popup() as of jQM 1.4.3
//$("#iHODPopupSettings").popup("open");
$('a[data-rel="popup"]').on("click", function () {
$("#iHODPopupSettings").popup("open", {
transition:"pop"
});
//console.log("creating popup...");
}); //else {
//console.log("There is a popup in the DOM!!");
}
});
// /jQM popup settings injection
var" g_html_popup_settings"是ruby / rails处理过的HTML。 我已经能够通过这种方式将面板和工具栏jQM小部件实现到我应用的所有区域。 这个小部件是不同的,因为弹出窗口必须绑定到click事件以生成" modal" / popup。 当使用jQM的默认AJAX用法导航到页面时,我将失去打开弹出窗口的按钮的功能。注入窗口小部件的上述方法适用于使用
的所有导航data-ajax="false"
但是,我想要一个解决方案,我不必担心显示的页面是否通过AJAX进入。我不知道' pagebeforecreate'无论页面容器加载是否为AJAX,事件都阻止我对窗口小部件进行某种通用的表示。
所有按钮均使用以下标记创建...
<!-- settings modal button -->
<a href="#IHODPopupSettings" data-rel="popup" data-position-to="window"
class="ui-btn ui-btn-inline ui-mini ui-corner-all ui-btn-icon-left ui-icon-gear">Settings
</a>
<!-- /settings modal button -->
对此问题的任何帮助或见解将不胜感激。 在此先感谢您对此进行审核。