在使用 jQuery 的页面上使用 Prototype JS

发布于 2024-09-12 10:09:12 字数 436 浏览 0 评论 0原文

我正在改造一个现在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文