Bootstrap Carousel not working if not put jquery

1k views Asked by At

so the problem is this, I made a carousel with bootstrap and I just put bootstrap.js for javascript. But why does slide carousel not work? whereas if I put jquery, then it can work !! Is not there a javascript in the bootstrap.js file to call the carousel? any solutions? I want to create a carousel using bootstrap.js without using jquery.js

2

There are 2 answers

0
juzraai On

Bootstrap's JavaScript components depend on jQuery:

Bootstrap is an open source toolkit for developing with HTML, CSS, and JS. Quickly prototype your ideas or build your entire app with our Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful plugins built on jQuery.

The quick start guide also states that jQuery is required:

Add our optional JavaScript plugins, jQuery, and Popper.js) near the end of your pages, right before the closing </body> tag. Be sure to place jQuery and Popper.js first, as our JavaScript plugins depend on them. While we use jQuery’s slim build in our docs, the full version is also supported.

You cannot get around this. If you want a carousel without jQuery, you should forget Bootstrap's carousel and look for another option. (For example here)

0
user2920648 On

This is the first line of code from the bootstrap.js file for v3.3.7

if (typeof jQuery === 'undefined') {
  throw new Error('Bootstrap\'s JavaScript requires jQuery')
}

the next line of code states that you need a minimum version of jquery 1.9.1 and a maximum of jquery 4 to be able to use bootstraps javascript