trigger(event, [args]) ⇒ self
在对象集合的元素上触发指定的事件。事件可以是一个字符串类型,也可以是一个 通过$.Event 定义的事件对象。如果给定args参数,它会作为参数传递给事件函数。
// add a handler for a custom event $(document).on('mylib:change', function(e, from, to){ console.log('change on %o with data %s, %s', e.target, from, to) }) // trigger the custom event $(document.body).trigger('mylib:change', ['one', 'two'])
Zepto仅仅支持在dom元素上触发事件。