0

JavaScript/JQuery: $(window).resize how to fire AFTER the resize is completed?

I am trying to understand the solution for the above question. I am trying to achieve something similar limit number of times resize gets called. But can any one please spend couple minutes and explain me how this function works.

1) how the unique string works here. 2) Can i see any working example. 3) Should i be changing the unique string each time, like generate any random string?

Learning js. Any help will be appreciated.

Community
  • 1
  • 1

1 Answers1

0

The code in the first answer is actually a working example. It requires jquery, and you'd have to put it inside a $(document).ready(), but it works great. See this fiddle. The unique string can be just any unique string, including the string the author used, "some unique string". But no, you would not change it on each resize event. You would assign a unique name to the type of event you are trying to process. If you were doing this for resizing, you might use "resizing" as your unique string. If you were doing it for some other event, maybe keydown, you could use "keydown" as your unique string.

The id is just a way to allow reuse of the functionality and also to track when the rapid-fire event has finally quiesced.

SaganRitual
  • 3,143
  • 2
  • 24
  • 40