JavaScript onresize event fires multiple times
javascript
Solution
The resize event is called once for every frame during the resizing operation. If you want to call it when resizing is finished, just set timer with a callback function.
var timeOut = null;
window.onresize = function(){
if (timeOut != null)
clearTimeout(timeOut);
timeOut = setTimeout(function(){
// YOUR RESIZE CODE HERE
}, 500);
};
Problem
I'm having some trouble trying running a function only once when onresize event is triggered, I have looked at this questions DOM onresize event but I'm not using jQuery and can't get that function to work without. Any suggestions?