Вариант №1
http://api.jquery.com/category/events/event-object/
| Цитата | | As of jQuery 1.6, you can also pass an object to jQuery.Event() and its properties will be set on the newly created Event object. |
http://jsfiddle.net/Aliance/uTTkJ/
Добавлено @ 15:54
Вариант №2
http://api.jquery.com/trigger/
| Цитата | When we define a custom event type using the .bind() method, the second argument to .trigger() can become useful. For example, suppose we have bound a handler for the custom event to our element instead of the built-in click event as we did above:
| Код | $('#foo').bind('custom', function(event, param1, param2) { alert(param1 + "\n" + param2); }); $('#foo').trigger('custom', ['Custom', 'Event']);
|
The event object is always passed as the first parameter to an event handler, but if additional parameters are specified during a .trigger() call, these parameters will be passed along to the handler as well. To pass more than one parameter, use an array as shown here. As of jQuery 1.6.2, a single parameter can be passed without using an array.
Note the difference between the extra parameters we're passing here and the eventData parameter to the .bind() method. Both are mechanisms for passing information to an event handler, but the extraParameters argument to .trigger() allows information to be determined at the time the event is triggered, while the eventData argument to .bind() requires the information to be already computed at the time the handler is bound.
|
http://jsfiddle.net/Aliance/uTTkJ/1/ |