Skip to content

Instantly share code, notes, and snippets.

@devdays
Created February 26, 2015 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devdays/0ab7d2edc6eb2b210767 to your computer and use it in GitHub Desktop.
Save devdays/0ab7d2edc6eb2b210767 to your computer and use it in GitHub Desktop.
Ways of invoking and receiving a Trigger in a widget
// in your widget
// call the callback event named 'hover' the client code
this._trigger( "hover",
// send e as the original event back as part of the callback
e /* e.type == "mouseenter" */, {
// return the uiObject e.Target in the hovered parameter of the event
// you could also respond with data that the user might need
hovered: $( e.target )
});
// The user can subscribe using an option during initalization
$( "#elem" ).filterable({
hover: function( event, ui ) {
// your response goes here
}
});
// Or with traditional event binding/delegation
$( "#elem" ).bind( "filterablehover" , function( event, ui ) {
// your response goes here
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment