Can I use twitter bootstrap without jquery?
Asked Answered
G

5

107

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

Is twitter bootstrap dependant on it ?

Gusgusba answered 30/1, 2013 at 16:19 Comment(0)
H
99

Twitter bootstrap itself isn't jQuery dependant.

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

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

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

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

Hormone answered 30/1, 2013 at 16:23 Comment(1)
And some jQuery plugins can be replaced with pure CSS, e.g. for mobile navbar - #31507184Marlo
C
42

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/

Clariceclarie answered 8/5, 2013 at 10:56 Comment(3)
No, you still need JavaScript enabled for effects such as showing/hiding the menu and closing alert boxes.Clariceclarie
Actually you can use it without those componentsHusein
You're right, you can still use Bootstrap but you'd have to avoid using collapsible menus, alert/dialog boxes, etc. and strip them out of the example pages if you use them as templates.Clariceclarie
I
40

Yes you can via Native Javascript for Bootstrap. Enjoy

Intracranial answered 2/4, 2015 at 11:41 Comment(2)
I used bootstrap.native in a small project recently that only needed a few bits of Bootstrap's js, and was very happy with the result.Hash
It's nice to write shameless self-advertisement when promoting your github repo on stackoverflow.Prinz
F
7

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

Flameout answered 23/1, 2020 at 12:49 Comment(0)
D
2

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

Try one of these:

  1. Bootstrap Native
  2. Bootstrap Native JavaScript
  3. Vue.js
Divestiture answered 10/9, 2018 at 18:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.