jQuery(document).ready(function() {
(function($) {
// #1
// Catch event
$(document).bind('MY_EVENT', function()
{
// do something
});
// Fire event
$(document).trigger('MY_EVENT');
// !#1
// #2
$(document).on('MY_EVENT2', function(event, param1, param2) {
alert(param1 + "\n" + param2);
});
$(document).trigger('MY_EVENT2', ['param1_string', 'param2_string']);
// !#2
})(jQuery);
});
Last active
March 9, 2024 23:45
-
-
Save abenevaut/5851002 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment