Created
February 26, 2015 19:05
-
-
Save devdays/0ab7d2edc6eb2b210767 to your computer and use it in GitHub Desktop.
Ways of invoking and receiving a Trigger in a widget
This file contains 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
// 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 ) | |
}); |
This file contains 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
// 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