-
-
Save attila/5574857 to your computer and use it in GitHub Desktop.
Use $._data to get event data as $(this).data('events') has been removed from jQuery 1.8+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.preBind = function(type, data, fn) { | |
this.each(function() { | |
var $this = $(this); | |
$this.bind(type, data, fn); | |
var currentBindings = $._data($this[0], 'events'); | |
if ($.isArray(currentBindings[type])) { | |
currentBindings[type].unshift(currentBindings[type].pop()); | |
} | |
}); | |
return this; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment