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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:22:45+00:00 2026-05-15T16:22:45+00:00

On jQuery resize event page it is said that: Code in a resize handler

  • 0

On jQuery resize event page it is said that:

“Code in a resize handler should never
rely on the number of times the
handler is called. Depending on
implementation, resize events can be
sent continuously as the resizing is
in progress (the typical behavior in
Internet Explorer and WebKit-based
browsers such as Safari and Chrome),
or only once at the end of the resize
operation (the typical behavior in
Firefox).”

Right now I observe increasing memory leak in my app, as I’m continuously resizing browser window, which in it’s turn continuously triggers specific code. I thought resize event is called only once in the end of the resize operation, but now after reading this I think my code is simply overkilling itself.

Is there any established practice to trigger a callback cross-browser only once, when resize operation has already ended?

  • 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-15T16:22:45+00:00Added an answer on May 15, 2026 at 4:22 pm

    As you are using jQuery anyway, have a look at Ben Alman’s doTimeout plugin. You can use it to debounce your event handler.

    There is even an example that matches exactly your case:

    $(window).resize(function(){
      $.doTimeout( 'resize', 250, function(){
        // do something computationally expensive
      });
    });
    

    The key here is that, the function passed to doTimeout is only executed if the resize handler is not called (i.e. the resize event is not fired) again during the next 250 ms. If so, the timer is aborted and a new one is started.

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

Sidebar

Related Questions

I have the code that works at current jQuery.event.add(window, load, resizeFrame); jQuery.event.add(window, resize, resizeFrame);
I'm using this plugin for jquery called resize-crop: http://code.google.com/p/resize-crop/ The problem with this is
I just noticed that the jquery resize event fires twice any time the browser
I have this page that displays pictures in a div. I have jquery cycle
I have a jquery function that changes an image depending on scroll position. This
I have a page with a number of links with a class called myLinkClass.
The Solution: http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/ Development Issue: I am having an IE7 compatibility issue with jQuery.
Possible Duplicate: Cross-browser window resize event - JavaScript / jQuery Jquery flash of unstyled
How can I hook into a browser window resize event? There's a jQuery way
I have a function resizePreview() that will resize an image in a jQuery dialog

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.