/*
*
* Facebox also has a bunch of other hooks:
*
* loading.facebox
* beforeReveal.facebox
* reveal.facebox (aliased as 'afterReveal.facebox')
* init.facebox
* afterClose.facebox
*
*/
我正在使用 Facebox .在源代码中我发现了一些钩子(Hook),但我只能找到使用“beforeReveal”的一行:$(document).trigger('beforeReveal.facebox')
。我找不到它的定义位置。所以我想知道它是如何工作的。希望得到一些帮助。非常感谢!
最佳答案
这些只是您可以订阅的自定义事件(例如 click
是预定义的事件):
$(document).on('beforeReveal.facebox', function() {
// This code here is now executed every time before the facebox is revealed,
// because Facebox triggers this event.
});
阅读文档中的更多信息:http://api.jquery.com/trigger/
关于javascript - 什么是facebox 'hooks',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11842657/