在使用 jQuery 的页面上使用 Prototype JS
我正在改造一个现在使用 jQuery 的网站。该过程已完成一半以上,但目前我需要尽快设置一个演示。为此,我将按原样复制现有 ASP 代码,并且这些特定页面需要原型插件。将所有原型插件转换为 jQuery 都在待办事项列表中。因此,我想知道是否有一种解决方法可以同时使用,让两个库在同一页面上工作。解决方法是暂时的,我最终会将插件移植到 jQuery(或使用 jQuery 替代方案)。
编辑
好,所以我更喜欢坚持使用 $ = jQuery。我修改后的问题是:原型是否有无冲突选项?我可以将所有原型插件代码包装在包装器中,所以想知道是否可以执行以下操作:
(function(/* what comes here? */) {
// some code that uses $ and $$
})(/* what comes here? */);
I am revamping a website that now uses jQuery. The process is more than half way done but for the time being I need to setup a demo as soon as possible. For this I will copy existing ASP code as-is and these particular pages require prototype plugins. Converting all prototype plugins to jQuery is in the todo list. So I am wodering if there is a workaround that I can use in the mean time to have both libraries working on same page. The workaround is temporary, I'll port the plugins to jQuery (or use a jQuery alternate) eventually.
Edit
OK, so I prefer to stick with $ = jQuery. My revised question is: does prototype have a no conflict option? I can wrap all prototype plugin code inside wrappers, so wondering if it is possible to do a:
(function(/* what comes here? */) {
// some code that uses $ and $
})(/* what comes here? */);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以阅读将 jQuery 与其他库结合使用。
You could read about Using jQuery with Other Libraries.