Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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