Hi Doug,
Let's do the following example.
Custom JavaScript code:prevar Panel = function(id) {
var that = {},
_panel = $(id);
var page = panel.parents("[data-role=page]");
page.append(panel);
_panel.on("panelbeforeopen", function( event, ui ) {
$(".view_alert").die().live("click", function() {
alert("view alert")
});
Code: Select all
$(".close_panel").die().live("click", function() {
that.close();
});
});
that.open = function() {
_panel.panel("open");
}
that.close = function() {
_panel.panel("close");
}
return that;
};/pre
Component HTML code:precode
<div data-role="panel" data-position="right" id="mypanel" data-display="overlay" data-theme="a">
<a data-role="button" class="view_alert">View Alert</a>
<a data-role="button" class="close_panel">Close</a>
</div>/code/preFor every Panel you should set its own mypanel (we'll use mypanel and mypanel2).
On Page Load run the following code:prepanel = new Panel("#mypanel");
panel2 = new Panel("#mypanel2");/pre
Then call the Panel: on button click add panel.open(), or panel2.open(), accordingly.