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
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…
I use, and can highly recommend, the Sonoff Zigbee 3.0 USB Dongle Plus with my Home Assistant server (running ZHA). However, recently I had an issue where I added a new Aqara Smart Plug to my setup, and while adding it went just fine, it didn't reflect the power measurements in…
Let's get straight to the point, I'm terrible at breakfast. It's always been way to easy for me to just skip it and not eat anything until lunch. Not exactly ideal. Since I'm not the least motivated to make breakfast in the morning, I decided to go for something I…