Recently I was asked about jQuery’s resize event. It runs its resize while the users resizes the window – meaning it can be triggered hundreds of times before ending the resize. Is there a way to wait until the user is done resizing?
I know jQuery isn’t the coolest kid on the block anymore, but I thought this still could be useful for anyone wondering about the same thing.
The solution I propose is to add a timer to the resize event. Whenever the resize event runs, it will hold off for a specific amount of time until running it’s script. Using this, we can register our own resize-start and resize-end events.
The threshold is something you can set yourself. For the example code I used 250ms.
Here are some other posts you may like
I wanted to monitor the power usage of our water heater. However, because it draws 3000W, there weren't a ton of options for what smart plug to use that supported both the needed wattage, zigbee and power monitoring. I ended up buying an ELKO SmartPlug 16A Zigbee plug. Since there…
Elon announced recently that a dashcam feature will be enabled in the upcoming v9 software update. Tesla owners have been waiting for this feature for over a year, after Elon mentioned it last year as arriving "soon". Now that this feature is getting closer though, I've noticed Tesla AP1 car…
Electric power companies, in general, are pretty much the same. Tibber however, is unlike any electricity company I had seen before. They try to utilise the data we get from smart devices, which they also sell, to save electricity, money and the environment, as well as improving comfort. It’s a…