jquery mobile, issue when changing page -


inside jquery mobile website i'm sending footer textinput request controller sends json data view popup window (data inside popup window rendered using jstemplate).

everything works expected when change page request passed controller popup window not showing.

from js function i'm sending

 $("#mydatapopup").popup("open").enhancewithin(); 

and inside _layout.cshtml

<div id="mydatapopup" data-role="popup" class="ui-content" data-theme="a" /> 

again, works fine until change page (since code inside _layout) should work on other pages well.

since you're using jquery mobile 1.4, recommend using external popup can accessed page. external popup should placed outside page div data-role="page" , should initialized manually.

external popup:

<div data-role="popup">   <!-- contents --> </div>  <div data-role="page">   <!-- contents --> </div> 

initialize external popup:

if popup contains other jqm widgets, need initialize widgets calling .enhancewithin(). otherwise, .popup() enough.

$(function () {   $("#popupid").popup().enhancewithin(); }); 

open/close popup:

  • dynamically

    /* enhance jqm widgets inside popup, if */   $("#popupid").popup("open").enhancewithin(); /* close */ $("#popupid").popup("close"); 
  • statically

    <a href="#popupid" data-rel="popup">popup</a> 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -