So i am trying to build this website and as i go on i decided to use a bootstrap carousel, i already had a dropdown button in the navbar and a collapse menu when on smaller viewports and it all worked fine, but when i was implementing the carousel it had a delay between images. It was almost like a white page between them and i wasnt sure if my website was simply slow or if it was a feature of the carousel but since the other features worked fine then i doubted it was the website speed problem, also it has almost no code whatsoever. So i had a bunch of script codes for bootstrap css and js and i decided to delete them all and put simply the 2 that are on the official bootstrap website and since then not just the carousel problem persists (the huge delay between images with a blank white space) and also the other features stoped working. Can someone help me implement bootstrap correctly?
heres the full code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI N" crossorigin="anonymous">
<title>Name</title>
</head>
<body>
<!--------------------------------------------- NAVIGATION BAr --------------------------------------------------->
<nav >
<a href="#">Name</a>
<button type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span ></span>
</button>
<div id="navbarSupportedContent">
<ul >
<li >
<a href="/index.html">Home <span ></span></a>
</li>
<li >
<a href="/test.html"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M1.885.511a1.745 1.745 0 0 1 2.61.163L6.29 2.98c.329.423.445.974.315 1.494l-.547 2.19a.678.678 0 0 0 .178.643l2.457 2.457a.678.678 0 0 0 .644.178l2.189-.547a1.745 1.745 0 0 1 1.494.315l2.306 1.794c.829.645.905 1.87.163 2.611l-1.034 1.034c-.74.74-1.846 1.065-2.877.702a18.634 18.634 0 0 1-7.01-4.42 18.634 18.634 0 0 1-4.42-7.009c-.362-1.03-.037-2.137.703-2.877L1.885.511z"/>
</svg></i> Contact</a>
</li>
<li >
<a href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Services
</a>
<div aria-labelledby="navbarDropdown">
<a href="#"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/>
</svg> Booking</a>
<a href="#">Another action</a>
<a href="#">Something else here</a>
</div>
</li>
</ul>
<span >
Name o slogan
</span>
</div>
</nav>
<!--------------------------------------------- NAVIGATION BAr --------------------------------------------------->
<!-------------------------------------------- HERO ----------------------------------------------------->
<div style="
height: 700px;
">
<div >
<div >
<h1 >Daniela Gonçalves Manicure</h1>
<h4 >Frontignan</h4>
<a href="#!" role="button">Prendez a rendevouz</a>
</div>
</div>
</div>
</div>
<!-------------------------------------------- HERO ----------------------------------------------------->
<div ></div>
<!-------------------------------------------- Carroussel ------------------------------------------------------->
<div id="carouselExampleControls" data-bs-ride="carousel">
<div >
<div style="background-color: aqua;">
<img src="..." alt="...">
</div>
<div style="background-color: black;">
<img src="..." alt="...">
</div>
<div style="background-color: rgb(250, 0, 0);">
<img src="..." alt="...">
</div>
</div>
<button type="button" data-bs-target="#carouselExampleControls" data-bs-slide="prev">
<span aria-hidden="true"></span>
<span >Previous</span>
</button>
<button type="button" data-bs-target="#carouselExampleControls" data-bs-slide="next">
<span aria-hidden="true"></span>
<span >Next</span>
</button>
</div>
<!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
i tried different versions cdn and it still does not work
CodePudding user response:
It looks like your link isn't the latest update available. In your header, try this link instead :
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
CodePudding user response:
Looks like you're just using the wrong version of bootstrap's css/js.
Change
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI N" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
to
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
so you're using bootstrap v5.0.2 (not css v4.6.2 and js v5.2.2).
Here is a working example.
.slide img {
height: 150px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Name</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</head>
<body>
<div id="carouselExampleControls" data-bs-ride="carousel">
<div >
<div style="background-color: aqua;">
<img src="https://via.placeholder.com/150?text=a" alt="...">
</div>
<div style="background-color: black;">
<img src="https://via.placeholder.com/150?text=b" alt="...">
</div>
<div style="background-color: rgb(250, 0, 0);">
<img src="https://via.placeholder.com/150?text=c" alt="...">
</div>
</div>
<button type="button" data-bs-target="#carouselExampleControls" data-bs-slide="prev">
<span aria-hidden="true"></span>
<span >Previous</span>
</button>
<button type="button" data-bs-target="#carouselExampleControls" data-bs-slide="next">
<span aria-hidden="true"></span>
<span >Next</span>
</button>
</div>
</body>
</html>