(function($){
'use strict';
var slice=Array.prototype.slice;
$.extend($.event.special, {
resizestop: {
add: function(handle){
var handler=handle.handler;
$(this).on('resize', function(e){
var _proxy;
clearTimeout(handler._timer);
e.type='resizestop';
_proxy=$.proxy(handler, this, e);
handler._timer=setTimeout(_proxy, handle.data||200);
});
}},
resizestart: {
add: function(handle){
var handler=handle.handler;
$(this).on('resize', function(e){
clearTimeout(handler._timer);
if(! handler._started){
e.type='resizestart';
handler.apply(this, arguments);
handler._started=true;
}
handler._timer=setTimeout(
$.proxy(function(){
handler._started=false;
}, this),
handle.data||300
);
});
}}
});
$.extend($.fn, {
resizestop: function(){
$(this).on.apply(this, [ 'resizestop' ].concat(slice.call(arguments)));
},
resizestart: function(){
$(this).on.apply(this, [ 'resizestart' ].concat(slice.call(arguments)));
}});
}(window.jQuery));