html - Dynamic page transitions in jQuery Mobile -
as part of new project, have dynamically create jquery mobile pages navigated between. need able create page, navigate it, delete previous page. these pages created json provided server. intention avoid using static markup these pages , create them entirely dynamically.
unfortunately, seems transitions no longer work- 1 can working method fade. funny thing is, seems i'm not 1 problem. jquery mobile have demo page has same issue. they're not setting transition property, should default slide, it's fading, mine.
looking problem has not helped. others seem have problem, no solution. known issue jquery mobile, , causes it? have use static pages?
i have made original fiddle work using event delegation bind dynamic button:
var pagename = "default"; $(document).ready(function () { function changepage() { var newname = pagename == "alpha" ? "beta" : "alpha"; $("body").append("<div id=\"" + newname + "\" data-role=\"page\"><a id=\"dynamicbutton\" data-role=\"button\">" + pagename + "</a></div>"); $(":mobile-pagecontainer").pagecontainer("change", "#" + newname, { transition: "slide" }); $("#" + pagename).remove(); pagename = newname; }; changepage(); $(document).on("click", "#dynamicbutton", function () { changepage(); }); });
updated fiddle
Comments
Post a Comment