Skip to content

Instantly share code, notes, and snippets.

@poonkave
Created December 19, 2012 12:07
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 poonkave/4336235 to your computer and use it in GitHub Desktop.
Save poonkave/4336235 to your computer and use it in GitHub Desktop.
Dynamic LI's and Popups
$(document).on('pageshow', '#home', [], function () {
$("#addLiPopup").one("click", function () {
$(this).hide();
injectLiAndPopup();
});
});
function injectLiAndPopup() {
var _UL = $.mobile.activePage.find(":jqmData(role=listview)");
var _LI = '<li><a><img class="rotate" src="http://jquerymobile.com/demos/1.2.0/docs/lists/images/album-mg.jpg"> <h1>Congratulations</h1> <p> MGMT </p> </a><a href="#congratulations" data-rel="popup" data-transition="flip">Details</a></li>';
_UL.append(_LI).listview("refresh");
var _POPUP = '<div data-role="popup" id="congratulations" data-theme="d" data-overlay-theme="b" class="ui-content" style="max-width:340px;"> <img src="http://jquerymobile.com/demos/1.2.0/docs/lists/images/album-mg.jpg"> </div>';
$.mobile.activePage.find(":jqmData(role=content)").append(_POPUP).trigger("create");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment