Skip to content

Instantly share code, notes, and snippets.

@elrrrrrrr
Created June 13, 2017 07:38
Show Gist options
  • Save elrrrrrrr/a19d8239b6a39b77d2476c6655976de7 to your computer and use it in GitHub Desktop.
Save elrrrrrrr/a19d8239b6a39b77d2476c6655976de7 to your computer and use it in GitHub Desktop.
bind before
$.fn.bindUp = function(type, fn) {
type = type.split(/\s+/);
this.each(function() {
var len = type.length;
while( len-- ) {
$(this).bind(type[len], fn);
var evt = $.data(this, 'events')[type[len]];
evt.splice(0, 0, evt.pop());
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment