diff --git a/js/index.js b/js/index.js index 1535799..b9343b7 100644 --- a/js/index.js +++ b/js/index.js @@ -1,4 +1,5 @@ import './src/Button'; import './src/Form'; import './src/quizCard'; -import './src/alertBox'; \ No newline at end of file +import './src/alertBox'; +import './src/Carousel'; diff --git a/js/src/Carousel.js b/js/src/Carousel.js new file mode 100644 index 0000000..bd44e52 --- /dev/null +++ b/js/src/Carousel.js @@ -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"; +} \ No newline at end of file diff --git a/scss/_alert.scss b/scss/_alert.scss new file mode 100644 index 0000000..4e836d0 --- /dev/null +++ b/scss/_alert.scss @@ -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; + } \ No newline at end of file diff --git a/scss/_carousel.scss b/scss/_carousel.scss new file mode 100644 index 0000000..fd53b11 --- /dev/null +++ b/scss/_carousel.scss @@ -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} +} \ No newline at end of file diff --git a/scss/metal.scss b/scss/metal.scss index 5a7362d..ed666af 100644 --- a/scss/metal.scss +++ b/scss/metal.scss @@ -13,4 +13,6 @@ @import "checkbox"; @import "radiobox"; @import "table"; -@import "dropmenu"; \ No newline at end of file +@import "dropmenu"; +@import "carousel"; +@import "alert"; diff --git a/site/layouts/index.html b/site/layouts/index.html index 1c4e16b..336ce4b 100644 --- a/site/layouts/index.html +++ b/site/layouts/index.html @@ -1,5 +1,4 @@ {{ define "main" }} -
+ +