Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8110433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:45:09+00:00 2026-06-06T01:45:09+00:00

I have a Jquery Mobile page into which I’m loading a form via AJAX.

  • 0

I have a Jquery Mobile page into which I’m loading a form via AJAX. I’m setting the page dimensions using a plugin, which calculates dimensions AFTER the Ajax has run and the layout has been updated (at least the below consoles come in afterwards).

I need to get the height of the element that received the content, but no matter what I try, I’m just getting rubbish ( ~ 169px instead of some 1200px)

Here is my code:

(inside plugin)
some: function(){

    var self = this,
    o = self.options,
    wrap = $('div:jqmData(wrapper="true").ui-page-active').last(),
    // elements
    panels = wrap.find('.ui-panel.ui-panel-active').filter(':not(.ui-popover)'),
    pages = panels.find('.ui-page'),
    contents = pages.find('.ui-content');

    // maxHeight contents
    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() );    
    // max
    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’m not using any AJAX this works correctly. If I’m adding content dynamically via AJAX, the consoles all fire after the AJAX, but still only return false values.

Question:
How can I reliably get the content element height after an AJAX update? I tried setting a 10sec timeout after Ajax to wait until everything is there. No difference, after 10sec the content element height is still not correct.

Thanks for help!

EDIT:
Although the consoles log AFTER the AJAX load, I think the function is firing before, so it’s calcualting based on pre-AJAX dimensions. I’m thinking to re-fire using this:

$(window).on('dimensionchange', function(){             
    self.ome();
    })

And triggering

$(window).trigger(‘dimensionchange’)

in my AJAX success handler. Not perfect, but I guess this will do.

EDIT2:
Got it to work. @HolgerDSchauf was correct. On my first function run, I set the false values and then after AJAX came in, the false value were still set. I’m now fixing it like this:

Ajax Success:

...
// cleanup dimensions
$(window).trigger( 'dimensionclear');
...
window.setTimeout(function() {
   target.removeClass('.fade.in');
   // recalculate
   $(window).trigger('dimensionchange');    
   },250);

In my plugin:

$(window).on('dimensionchange', function(){ 
     self.ome();
     });
$(window).on('dimensionclear', function(){
     self.ome("clear");
     });    

And in OME function:

// cleanup
if ( from == "clear") {
   contents.css({'height':'', 'max-height':''})
   return;
   }

Works like a charm.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:45:10+00:00Added an answer on June 6, 2026 at 1:45 am

    you used an cache element with “wrap, panels, ct” refresh this cached variable or use it instantly

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Jquery Mobile shell page, which I'm loading a form into using
I'm using Jquery Mobile and have the same form on every page. As Jquery
I have a page on which I'm using JQuery Mobile. I am having difficulty
I have a login page using jQuery Mobile which contains the following code: <div
I have the code below loading into a jquery mobile page data-role. Two strange
I have a page which builded with jquery mobile and play framework. It's refreshing
I have been working with jQuery mobile 1.0.1. I have a page which drills
I have a single page jquery mobile application in which there are few parent
Using HTML5 and jQuery Mobile I have a page with 3 buttons. What I
I'm using Jquery Mobile pagination plugin and trying to work it into a plugin

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.