public
Created

  • Download Gist
manual_mobile_dialog.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 
//structure content div
var content = $("<div>").
attr("data-role", "content").
addClass("ui-content").
html($("div.buttons", this.$actionPanel).html());
 
//remove already duplicated buttons
$("a.ui-btn", content).remove();
 
//structure header
var header = $("<div>").attr("data-role", "header").html("<h1>Options for " + this.$name.html() + "</h1>");
 
//put it all together
var div = $("<div>").
attr("data-role", "dialog").
attr("id", "visit_dialog").
append(header).
append(content);
$("body").append(div);
div.dialog();
//overwrite close button handler by returning false
$("a", header).click(function(e){
e.preventDefault();
$.mobile.changePage([div, $("#page")], "fade", false, false);
return false;
});
 
$.mobile.changePage([$.mobile.activePage, div], "slidedown", false, false);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.