jquery - Pop up no displaying properly in mobile -
i using jquery mobile 1.4.2 trying create pop dynamically in page.its working fine in computer if open same page in mobile displaying second , going off. here code
html
<button id="yo1">click</button>
jquery
$(document).on('vclick','#yo1',function(){ var message = '<input name="im_user" type="text" class="valores" id="im_user"/><input name="im_password" type="password" class="valores" id="im_password" /><input name="inputads" type="submit" id="inputads" value="ingresar" />', popupafterclose = ''; runtimepopup(message, popupafterclose) }); function runtimepopup(message, popupafterclose) { var template = "<div data-role='popup' class='ui-content messagepopup'>" + "<a href='#' data-role='button' data-theme='g' data-icon='delete' data-iconpos='notext' " + " class='ui-btn-right closepopup'>close</a> <span> " + message + " </span> </div>"; popupafterclose = popupafterclose ? popupafterclose : function () {}; $.mobile.activepage.append(template).trigger("create"); $.mobile.activepage.find(".closepopup").bind("tap", function (e) { $.mobile.activepage.find(".messagepopup").popup("close"); }); $.mobile.activepage.find(".messagepopup").popup().popup("open").bind({ popupafterclose: function () { $(this).unbind("popupafterclose").remove(); popupafterclose(); } }); }
link jsfiddle demo. not displaying in mobile phones.working fine in computer.
try adding refresh after create
$.mobile.activepage.find(".messagepopup").popup("refresh");
after create popup.
Comments
Post a Comment