twitter-bootstrap 我可以在没有 jquery 的情况下使用 twitter bootstrap 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14608681/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 16:14:29  来源:igfitidea点击:

Can I use twitter bootstrap without jquery?

twitter-bootstrap

提问by Zo72

I work in a project where we don't use JQuery.

我在一个不使用 JQuery 的项目中工作。

Is twitter bootstrap dependant on it ?

twitter bootstrap 依赖于它吗?

采纳答案by Bruno Campos

Twitter bootstrap itself isn't jQuery dependant.

Twitter 引导程序本身不依赖于 jQuery。

If you use just the CSS part of it, you won't need jQuery.

如果你只使用它的 CSS 部分,你就不需要 jQuery。

If you use the Javascript plugins you need jQuery, since they are jQuery plugins.

如果您使用 Javascript 插件,则需要 jQuery,因为它们是jQuery 插件

v3: http://getbootstrap.com/javascript/

v3http: //getbootstrap.com/javascript/

v4: https://getbootstrap.com/docs/4.0/getting-started/javascript/

v4https: //getbootstrap.com/docs/4.0/getting-started/javascript/

回答by tagawa

Short answer is yes but as Bruno says, the jQuery plugins won't work. To workaround this, I made a small replacement script so the dropdown menus, alert boxes and collapsible nav bar will work without jQuery: http://daniemon.com/blog/bootstrap-without-jquery/

简短的回答是肯定的,但正如布鲁诺所说,jQuery 插件不起作用。为了解决这个问题,我做了一个小的替换脚本,这样下拉菜单、警告框和可折叠的导航栏将在没有 jQuery 的情况下工作:http: //daniemon.com/blog/bootstrap-without-jquery/

回答by thednp

Yes you can via Native Javascript for Bootstrap. Enjoy

是的,您可以通过Native Javascript for Bootstrap。享受

回答by Dan Bray

You do not need to use jQuery. Boostrap will perform better with native JavaScript than jQuery.

您不需要使用 jQuery。Boostrap 使用原生 JavaScript 比使用 jQuery 表现更好。

Try one of these:

尝试其中之一:

  1. Bootstrap Native
  2. Bootstrap Native JavaScript
  3. Vue.js
  1. 引导本机
  2. 引导原生 JavaScript
  3. Vue.js

回答by the_spectator

Bootstrap 5 will be without jQuery dependency. Reference: Concerned PR

Bootstrap 5 将不依赖 jQuery。参考:相关公关