I`m using jQuery Mobile (1.3.1) to display a popup (screen centered). Depending on the user actions, some content gets inserted into the popup via AJAX. This works fine, but there is one problem: Once the content is injected into the popup its size changes, but the position is not updated. As soon as the window is resized, the popup position gets refreshed, but so far I did not find a way to trigger this action manually.
Declaration of the popup:
<div id="MoveFolderPopup" data-role="popup" data-position-to="window" style="min-width: 20em">
Some things I already tried to reposition the popup to the window center (including a quick view to the popup widgets source code for some internal, undocumented events):
$('#MoveFolderPopup').trigger("reposition");
$('#MoveFolderPopup').trigger("_reposition");
$('#MoveFolderPopup').trigger("_handleWindowResize");
$('#MoveFolderPopup').trigger('refresh')
$(window).trigger('resize');
$('#MoveFolderPopup').popup('open');
$('#MoveFolderPopup').trigger('updatelayout');
I do not have many experiences with JavaScript and just don`t have any more ideas for this problem ;) Could someone please help me? Thanks!
$("#MoveFolderPopup").popup("reposition", {positionTo: 'origin'});
or
$("#MoveFolderPopup").popup("reposition", {positionTo: 'window'});
in this case either will do, because data-position-to="window"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With