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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:01:13+00:00 2026-05-23T08:01:13+00:00

$(img).load(function(){ var width = $(this).width(); var height = $(this).height(); if (width * height >

  • 0
$("img").load(function(){
  var width = $(this).width();
  var height = $(this).height();
    if (width * height > 40000) {

}});

I have this code, and I want to highlight an image that is larger than 40,000 pixels and if it is not inside a table. I know that using has() only gets descendants. would using load(function() be incorrect here?

  • 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-23T08:01:13+00:00Added an answer on May 23, 2026 at 8:01 am

    If you just want to select elements, you could use selectors:

    $images = $('img:area(40000)').not('table *');
    

    Of course, you ought to be asking, wtf is :area(40000)?

    Here you go:

    $.expr[':'].area = function(element, index, meta, stack){
      var $ele,
        size,
        area;
      $ele = $(element);
      size = parseInt( meta[3] );
      area = $ele.width() * $ele.height();
      return area > size;
    };
    

    With a little more time you could extend the custom selector to take a second param so that you could use >, <, ==, etc in a :area(40000,lt) style syntax.

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

Sidebar

Related Questions

I've an img element with dynamically changing image. I always want to show this
I'm loading an image exteranlly via ajax like so... function load_image(image_href) { var img
Edit: Here is the new code: $(#normalcontent).hide(fast).load($this.attr(href) + #normalcontent,,function(){ $(this).slideDown(normal); $(this).find(img).each(function(){ if($(this).hasClass(large)) { var
I am traing to load some images on client browser with this code: function
I have an img tag in my webapp that uses the onload handler to
var thumbs = document.getElementsByTagName(img); for (var i=0; i<thumbs.length; i++) { Core.addEventListener(thumbs[i], click, function() {alert(i);});
// Called when image is dropped in canvas function dropResource() { var imgIndex =
I have an element that serves as the banner on my website. This banner
I want to be able to do the callback of the .load() function when
I have a website that will fade out a section of my website, load

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.