何时在 Backbone 视图中附加 jQuery 插件
我正在尝试找出附加 jQuery 插件和一些基本 UI 设置功能的最佳且最便宜的方法。
目前,我可以想到两种方法:
1)渲染视图后触发函数。这意味着每次渲染视图时,都会重新附加插件等。这会导致内存等问题吗?
2)以某种方式模仿插件的 jQuery .live()...我不知道这是否可能有
什么想法吗?
I am trying to figure out the best and most inexpensive way to attach jQuery plugins and some basic UI setup functions.
Currently, I can think of two ways:
1) Fire a function after rendering the view. This means that each time the view is rendered, the plugins, etc are re-attached. Could this cause memory, etc issues?
2) Somehow mimic jQuery .live() for plugins... I don't know if that's even possible
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请记住,
jQuery.live
已弃用,您应该使用jQuery.on
代替,请参阅:http://api.jquery.com/delegate/无论如何,您可能会在这里找到一些有趣的解决方案:使用 jQuery 检测元素内容更改
Keep in mind that
jQuery.live
is deprecated and you should usejQuery.on
instead, see: http://api.jquery.com/delegate/Anyway you may find some interesting solutions here: Detect element content changes with jQuery