1
<head>
<link rel="stylesheet" type="text/css" href="css/style.css">
<title>Projeto 01</title>
<script>
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function currentDiv(n) {
showDivs(slideIndex = n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("demo");
if (n > x.length) {slideIndex = 1}
if (n < 1) {slideIndex = x.length}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" w3-white", "");
}
x[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " w3-white";
}
</script>
<body>
<div id="container">
<div class="topo">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Redes Sociais</a></li>
<li><a href="#">Blog</a></li>
</ul>
</div>
<div class="esquerda"></div>
<div class="direita">
<div class="w3-content w3-display-container">
<img class="mySlides" src="img/01.png">
<img class="mySlides" src="img/02.jpg">
<img class="mySlides" src="img/03.jpg">
<div class="w3-center w3-display-bottommiddle" style="width:100%">
<div class="w3-left" onclick="plusDivs(-1)">❮</div>
<div class="w3-right" onclick="plusDivs(1)">❯</div>
<span class="w3-badge demo w3-border" onclick="currentDiv(1)"></span>
<span class="w3-badge demo w3-border" onclick="currentDiv(2)"></span>
<span class="w3-badge demo w3-border" onclick="currentDiv(3)"></span>
</div>
CSS
#container {
background: white;
display: both;
}
.topo {
height: 200px;
background-color: teal;
box-shadow: 0 0 08px;
margin: 10px;
}
.topo p {
color: #000;
}
.topo ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
.topo li {
float: left;
}
.topo li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.topo li a:hover {
background-color: #111;
}
.conteudo {
display: block;
border-radius: 04px;
box-shadow: 0 0px 05px 0;
margin: auto;
padding: 20px;
width: 60%;
height: 600px;
background-color: orange;
float: both;
}
.conteudo p {
color: #000;
}
.esquerda{
width: 15%;
height: 400px;
background-color: ;
border: 1px solid #000;
margin: 30px;
border-radius: 03px;
float: left;
}
.direita {
width: 15%;
height: 400px;
background-color: ;
border: 1px solid #000;
margin: 30px;
border-radius: 03px;
float: right;
}
#rodape p {
text-align: center;
color: black;
font-size: 16px;
}
.mySlides {display:none}
.w3-left, .w3-right, .w3-badge {cursor:pointer}
.w3-badge {height:13px;width:13px;padding:0}
I have little knowledge in the development area. I only know the basics in Html and CSS (I don’t know javascript or jquery). But still, I need to create a small slide for a project I’m developing.
- I need to add the images in a small side DIV, where it displays only one image and a caption/description just below NOT superimposing the image;
- With Next and Previous button;
- Caption/description needs to be updated along with image;
- I need to know how to hide the images and make them appear in a certain time;
- I’ve done research, but I’ve had no knowledge or understanding about;
- Since it’s only about HTML and CSS, you don’t find much on the internet;
- In a book I was reading CSS - from beginner to professional I read about Overflow and Animation. But I don’t know how to apply them;
- And so far I don’t know how I should build the structure for it;
There’s a very good <br/> https://www.w3schools.com/howto/howto_js_slideshow.asp Works with pure CSS and javascript, and you don’t need to install plugins or jquery. What helps in performance.
– Sveen