Closed mfields closed 10 years ago
Thanks for the tip. Also related: http://www.paulirish.com/2009/throttled-smartresize-jquery-event-handler/
Ended up using Remy Sharp's method.
http://remysharp.com/2010/07/21/throttling-function-calls/
function debounce(fn, delay) {
var timer = null;
return function () {
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
fn.apply(context, args);
}, delay);
};
}
theme.js line 64:
This has the potential to fire for every pixel the browser "visits" during a resize. While some browsers handle it better than others, it's still a lot of work. It's best to throttle or debounce such methods.
Here is a good solution: http://benalman.com/projects/jquery-throttle-debounce-plugin/