element.bind(“resize.container”, function() { .. } );
这是做什么的:
element.bind("resize.container", function() {
//.....
});
显然,它是通过调整大小事件调用的,但是 .container 位是做什么用的?
我也没有找到任何关于这种语法“event.bla”的文档——目的是什么?
谢谢, 韦斯利
What does this do:
element.bind("resize.container", function() {
//.....
});
Apparently, it gets called with the resize event, but what is the .container bit for?
I also didn't find any documentation about this kind of syntax "event.bla" -- what is the purpose?
Thanks,
Wesley
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
.container
用作命名空间。使用此命名空间,您可以取消元素上resize
事件的绑定,如下所示。注意:事件命名空间广泛用于插件开发中,以免页面或其他插件绑定在元素上的事件发生改变
Jquery 文档此处
.container
is used as a namespace. Using this namespace you can unbind theresize
event on element as belowNote: event namespacing is widely used in plugin development so as not to alter with the events bound on the element by the page or other plugins
Jquery documentation here
resize.container 是与元素的函数绑定的事件。这似乎是某人创建的自定义事件,名为
$().trigger("resize.container");
resize.container is the event that is getting bound with the function to the element. It seems like a custom event someone created, called like
$().trigger("resize.container");
如果您查看
bind()
的 jQuery 文档,您会看到以下签名:bind()
是:因此在本例中
resize.container
是一个 eventType。仅此而已。它不是本机事件(例如,click
或change
或load
),它是自定义事件。.
部分是关于命名空间的。您可以在此处阅读有关命名空间事件的信息。If you look at the jQuery documentation for
bind()
you see the signature forbind()
is:So in this case
resize.container
is an eventType. That's all it is. It's not a native event (like, say,click
orchange
orload
), it's a custom event. The.
part is about namespaces. You can read about namespaced events here.