I have a jQuery Mobile page in which I upload a form via AJAX. I set the page sizes using a plugin that calculates the sizes AFTER Ajax starts, and the layout has been updated (at least the following consoles appear later).
I need to get the height of the element that received the content, but no matter what I try, I just get garbage (~ 169px instead of 1200px)
Here is my code:
(inside plugin)
some: function(){
var self = this,
o = self.options,
wrap = $('div:jqmData(wrapper="true").ui-page-active').last(),
panels = wrap.find('.ui-panel.ui-panel-active').filter(':not(.ui-popover)'),
pages = panels.find('.ui-page'),
contents = pages.find('.ui-content');
for ( var i = 0; i < contents.length; i++){
ct = contents.eq(i);
console.log( ct );
console.log( ct.css("height") )
console.log( ct.height() );
console.log( ct.outerHeight() );
if ( ct.css("height") > parseFloat( o._iPadFixHeight ) ){
o._iPadFixHeight = parseFloat( ct.css("height") ) + parseFloat( ct.css('padding-top')) + parseFloat( ct.css('padding-bottom')) ;
};
}
...
If I do not use AJAX, this works correctly. If I dynamically add content through AJAX, all consoles start after AJAX, but still return only false values.
:
AJAX? - 10 Ajax, , . , 10 .
!
:
AJAX, , , AJAX. , :
$(window).on('dimensionchange', function(){
self.ome();
})
$(window).trigger('dimensionchange')
AJAX. , , .
EDIT2:
, . @HolgerDSchauf . , AJAX false . :
Ajax:
...
$(window).trigger( 'dimensionclear');
...
window.setTimeout(function() {
target.removeClass('.fade.in');
$(window).trigger('dimensionchange');
},250);
:
$(window).on('dimensionchange', function(){
self.ome();
});
$(window).on('dimensionclear', function(){
self.ome("clear");
});
OME:
if ( from == "clear") {
contents.css({'height':'', 'max-height':''})
return;
}
.