Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion js/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import './src/Button';
import './src/Form';
import './src/quizCard';
import './src/alertBox';
import './src/alertBox';
import './src/Carousel';
26 changes: 26 additions & 0 deletions js/src/Carousel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var slideIndex = 1;
showSlides(slideIndex);

function plusSlides(n) {
showSlides(slideIndex += n);
}

function currentSlide(n) {
showSlides(slideIndex = n);
}

function showSlides(n) {
var i;
var slides = document.getElementsByClassName("carousel");
var dots = document.getElementsByClassName("nav_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";
}
30 changes: 30 additions & 0 deletions scss/_alert.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.Warning {
padding: 20px;
background-color: #f44336; /* Red */
color: white;
margin-bottom: 15px;
}

.Success {
padding: 20px;
background-color: rgb(21, 160, 21); /* Green */
color: white;
margin-bottom: 15px;
}

/* The close button */
.closebtn {
margin-left: 15px;
color: white;
font-weight: bold;
float: right;
font-size: 22px;
line-height: 20px;
cursor: pointer;
transition: 0.3s;
}

/* When moving the mouse over the close button */
.closebtn:hover {
color: black;
}
96 changes: 96 additions & 0 deletions scss/_carousel.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
* {box-sizing: border-box}
.carousel {display: none}
img {vertical-align: middle;}

/* Slideshow container */
.slideshow-container {
max-width: 1000px;
position: relative;
margin: auto;
}

/* Next & previous buttons */
.prevSlide, .nextSlide {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
padding: 16px;
margin-top: -22px;
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 */
.nextSlide {
right: 0;
border-radius: 3px 0 0 3px;
}

/* On hover, add a black background color with a little bit see-through */
.prevSlide:hover, .nextSlide:hover {
background-color: rgba(0,0,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) */
.numbtext {
color: #f2f2f2;
font-size: 12px;
padding: 8px 12px;
position: absolute;
top: 0;
}

/* The dots/bullets/indicators */
.nav_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, .nav_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}
}

/* On smaller screens, decrease text size */
@media only screen and (max-width: 300px) {
.prevSlide, .nextSlide,.text {font-size: 11px}
}
4 changes: 3 additions & 1 deletion scss/metal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@
@import "checkbox";
@import "radiobox";
@import "table";
@import "dropmenu";
@import "dropmenu";
@import "carousel";
@import "alert";
68 changes: 67 additions & 1 deletion site/layouts/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{ define "main" }}

<div class="jumbotron jumbotron-fluid text-center" style="width:100vw;margin:0;padding:0;overflow:hidden;background-color:#e8e1e1">
<div class="container" style="padding:20px;">
<h1 class="display-4">{{ .Site.Title }}</h1>
Expand Down Expand Up @@ -167,6 +166,73 @@ <h4> Table </h4>
</div>
<button class="btn-contained">Click Me</button>
</div>
<div class="slideshow-container">

<div class="carousel fade">
<div class="numtext">1 / 3</div>
<img src="https://media.wired.com/photos/59271340ac01987bf0138709/master/pass/SpiderMan.jpg" style="width:100%" alt="">
<div class="text">First Slide</div>
</div>

<div class="carousel fade">
<div class="numtext">2 / 3</div>
<img src="https://static2.cbrimages.com/wordpress/wp-content/uploads/2020/12/The-Batman-Jim-Lee-Header.jpg" style="width:100%" alt="">
<div class="text">Second Slide</div>
</div>

<div class="carousel fade">
<div class="numtext">3 / 3</div>
<img src="https://www.screengeek.net/wp-content/uploads/2020/07/iron-man-captain-america-thor.jpg" style="width:100%" alt="">
<div class="text">Third Slide</div>
</div>

<a class="prevSlide" onclick="plusSlides(-1)">&#10094;</a>
<a class="nextSlide" onclick="plusSlides(1)">&#10095;</a>

</div>
<br>

<div style="text-align:center">
<span class="nav_dot" onclick="currentSlide(2)"></span>
<span class="nav_dot" onclick="currentSlide(3)"></span>
<span class="nav_dot" onclick="currentSlide(1)"></span>
</div>
<script>
var slideIndex = 1;
showSlides(slideIndex);

function plusSlides(n) {
showSlides(slideIndex += n);
}

function currentSlide(n) {
showSlides(slideIndex = n);
}

function showSlides(n) {
var i;
var slides = document.getElementsByClassName("carousel");
var dots = document.getElementsByClassName("nav_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>
<div class="Warning">
<span class="closebtn" onclick="this.parentElement.style.display='none';">&times;</span>
This is an alert box.
</div>
<div class="Success">
<span class="closebtn" onclick="this.parentElement.style.display='none';">&times;</span>
This is an alert box.
</div>

</div>
{{ end }}
13 changes: 12 additions & 1 deletion site/static/js/main.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.