问题描述
我正在尝试更新我的网站以使用 bootstrap 5,但是当我将以下链接添加到我的代码时,幻灯片消失了:
在添加上述链接之前我的代码看起来像这样,这使我的幻灯片消失了:
<head>
<title>Restless-Inc</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" type="text/css" href="restless-inc.css">
<style>
.statement {
font-size:30px;
position:relative;
top:35px;
}
h2 {
text-align:center;
padding-top:30px;
}
#page-title-index {
color:#0e5518;
width:500px;
font-size:50px;
margin:0 auto;
margin-top:40px;
}
* {box-sizing:border-box}
/* Slideshow container */
.slideshow-container {
max-width: 1000px;
position: relative;
margin: auto;
margin-top:50px;
display:block;
margin-left:auto;
margin-right:auto;
}
/* Hide the images by default */
.mySlides {
display: none;
}
/* Next & previous buttons */
.prev,.next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
margin-top: -22px;
padding: 16px;
color: white;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
}
/* Position the "next button" to the right */
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
/* On hover,add a black background color with a little bit see-through */
.prev:hover,.next:hover {
background-color: rgba(0,0.8);
}
/* Caption text */
.text {
color: #f2f2f2;
font-size: 15px;
padding: 8px 12px;
position: absolute;
bottom: 8px;
width: 100%;
text-align: center;
}
/* Number text (1/3 etc) */
.numbertext {
color: #f2f2f2;
font-size: 12px;
padding: 8px 12px;
position: absolute;
top: 0;
}
/* The dots/bullets/indicators */
.dot {
cursor: pointer;
height: 15px;
width: 15px;
margin: 0 2px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
transition: background-color 0.6s ease;
}
.active,.dot:hover {
background-color: #717171;
}
/* Fading animation */
.fade {
-webkit-animation-name: fade;
-webkit-animation-duration: 1.5s;
animation-name: fade;
animation-duration: 1.5s;
}
@-webkit-keyframes fade {
from {opacity: .4}
to {opacity: 1}
}
@keyframes fade {
from {opacity: .4}
to {opacity: 1}
}
#statement-container {
margin:0 auto;
max-width:1000px;
}
</style>
</head>
<body>
<div id="main-page">
<div id="top-bar-container">
<div id="top-bar-menu">
<div id="top-bar-menu3">
<a href="index.html">Home</a>
<a href="aboutme.html">Nick Perks</a>
<a href="webdev.html">Web development</a>
<a href="eth_hack.html">Ethical Hacking</a>
<a id="contactme" href="contactme.html">Contact me</a>
</div>
</div>
</div>
<div class="clear"></div>
<!-- Slideshow container -->
<div class="slideshow-container">
<div id="container2">
<!-- Full-width images with number and caption text -->
<div class="mySlides fade">
<img src="images/restless-banner5.png" style="width:100%">
</div>
</div>
<div class="mySlides fade">
<img src="images/dog-banner1.png" style="width:100%">
</div>
<!-- Next and previous buttons -->
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>
<br>
<!-- The dots/circles -->
<div style="text-align:center">
<span class="dot" onclick="currentSlide(1)"></span>
<span class="dot" onclick="currentSlide(2)"></span>
</div>
<div id="statement-container">
<p class="statement">The purpose of this site is to not only stand as an example of my work but to also be informative and a bit of fun.</p>
</div>
var 幻灯片索引 = 1;
showSlides(slideIndex);
// Next/previous controls
function plusSlides(n) {
showSlides(slideIndex += n);
}
// Thumbnail image controls
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active","");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
}
</script>
</body>
当我添加链接时,它看起来像这样:
<head>
<title>Restless-Inc</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="restless-inc.css">
<style>
.statement {
font-size:30px;
position:relative;
top:35px;
}
h2 {
text-align:center;
padding-top:30px;
}
#page-title-index {
color:#0e5518;
width:500px;
font-size:50px;
margin:0 auto;
margin-top:40px;
}
* {box-sizing:border-box}
/* Slideshow container */
.slideshow-container {
max-width: 1000px;
position: relative;
margin: auto;
margin-top:50px;
display:block;
margin-left:auto;
margin-right:auto;
}
/* Hide the images by default */
.mySlides {
display: none;
}
/* Next & previous buttons */
.prev,"");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
}
</script>
</body>
一旦我添加了链接,我的幻灯片就会消失。 jQuery UI 和 bootstrap 5.0 之间是否存在一些我应该知道的冲突?或者我只是犯了某种形式的错误?感谢您在这件事上为我提供的任何帮助。
问候
尼克
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)