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 6691165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:43:12+00:00 2026-05-26T05:43:12+00:00

EDIT: I’ve put this in a document ready function. The images are big though,

  • 0

EDIT: I’ve put this in a document ready function.
The images are big though, does document ready comply with large images?
you can see it not working here: http://syndex.me

This is driving me quietly insane.

var maxxxHeight = $(window).height();

$(".theImage").children('img').each(function() {
  myHeight = $(this).height();
      if ( myHeight > maxxxHeight ){
      $(this).next().text("Browser " + maxxxHeight + " image height " + myHeight);
  };
});

For some reason,

myHeight > maxxxHeight will not come up with anyhing. There are images whose sizes are bigger, and some not. The images are not being set by CSS. Their width and height are not specified at any point in fact.

How can this be? This is a total noob question, but i’v done if’s and < / > a million times before.

Thanks

  • 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-05-26T05:43:13+00:00Added an answer on May 26, 2026 at 5:43 am

    I can think of several reasons this might be happening.

    1. The images may not yet be completely loaded at the time the code runs.
    2. Your images may not be direct children of the element matching your class.
    3. Your code may be running before the document is loaded and nothing matches the class yet.

    My best guess is (1), in which case you should add a load handler for the images that does what you want when the image completes loading. Running the code on both document load and image load is probably in order in case the image is cached and the load event for it fires before the image load handler is applied. Image load would be necessary if the image is replaced dynamically after the document has been loaded.

    NOTE: You should be scoping myHeight locally to avoid polluting the global namespace (and potential bugs due to scoping issues).

    $(document).load( function() {
        var maxxxHeight = $(window).height();
    
        $(".theImage").children('img').each(function() {
            $(this).load( function() { // only if images can be loaded dynamically
                handleImageLoad(this);
            });
            handleImageLoad(this);
        });
    
        function handleImageLoad(img)
        {
            var $img = $(img),  // declare local and cache jQuery for the argument
                myHeight = $img.height();
            if ( myHeight > maxxxHeight ){
               // this is where your real code would go to make adjustments, etc.
               $img.next().text("Browser " + maxxxHeight + " image height " + myHeight);
            };
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: I have solved this by myself. See my answer below I have set
edit 10/8/10 @ 8:20am est - since I can't make this work in prod,
EDIT : What happens can be seen in this page when the height resolution
(EDIT: Let's title this, Lessons in how measurements can go wrong. I still haven't
Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: This question is more about language engineering than C++ itself. I used C++
edit #2: Question solved halfways. Look below As a follow-up question, does anyone know
Edit: This was accidentally posted twice. Original: VB.NET Importing Classes I've seen some code
EDIT: The cause of the errors (see below): my default primary key in doctrine_pi.php

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.