Skip to content

Instantly share code, notes, and snippets.

@dpickett
Created January 2, 2011 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpickett/762806 to your computer and use it in GitHub Desktop.
Save dpickett/762806 to your computer and use it in GitHub Desktop.
//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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment