(Created page with ".bss-slides{ position: relative; display: block; line-height: 0;→removes the gap if you put a border on the slideshow div: } figcaption { line-height: 1.5; /* re...") |
|||
Line 1: | Line 1: | ||
− | . | + | /*https://www.sitepoint.com/make-a-simple-javascript-slideshow-without-jquery*/ |
− | + | #slides{ | |
− | + | position: relative; | |
− | + | height: 150px; | |
+ | padding: 0px; | ||
+ | margin: 0px; | ||
+ | list-style-type: none; | ||
} | } | ||
− | + | ||
− | + | .slide{ | |
+ | position: absolute; | ||
+ | left: 0px; | ||
+ | top: 0px; | ||
+ | width: 100%; | ||
+ | height: 100%; | ||
+ | opacity: 0; | ||
+ | z-index: 1; | ||
+ | |||
+ | -webkit-transition: opacity 1s; | ||
+ | -moz-transition: opacity 1s; | ||
+ | -o-transition: opacity 1s; | ||
+ | transition: opacity 1s; | ||
} | } | ||
− | . | + | |
− | + | .showing{ | |
+ | opacity: 1; | ||
+ | z-index: 2; | ||
} | } | ||
− | + | ||
− | + | ||
− | + | ||
− | + | /* | |
− | + | non-essential styles: | |
− | + | just for appearance; change whatever you want | |
− | + | */ | |
− | + | ||
− | . | + | .slide{ |
− | + | font-size: 40px; | |
− | + | padding: 40px; | |
− | + | box-sizing: border-box; | |
− | + | background: #333; | |
− | + | color: #fff; | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
− | . | + | .slide:nth-of-type(1){ |
− | + | background: red; | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | background: | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
− | :- | + | .slide:nth-of-type(2){ |
− | + | background: orange; | |
− | + | ||
− | + | ||
} | } | ||
− | :- | + | .slide:nth-of-type(3){ |
− | + | background: green; | |
− | background | + | |
} | } | ||
− | :- | + | .slide:nth-of-type(4){ |
− | + | background: blue; | |
− | background | + | |
} | } | ||
− | : | + | .slide:nth-of-type(5){ |
− | + | background: purple; | |
− | + | ||
− | + | ||
} | } |
Revision as of 13:51, 1 November 2017
/*https://www.sitepoint.com/make-a-simple-javascript-slideshow-without-jquery*/
- slides{
position: relative; height: 150px; padding: 0px; margin: 0px; list-style-type: none;
}
.slide{
position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; opacity: 0; z-index: 1;
-webkit-transition: opacity 1s; -moz-transition: opacity 1s; -o-transition: opacity 1s; transition: opacity 1s;
}
.showing{
opacity: 1; z-index: 2;
}
/* non-essential styles: just for appearance; change whatever you want
- /
.slide{
font-size: 40px; padding: 40px; box-sizing: border-box; background: #333; color: #fff;
}
.slide:nth-of-type(1){
background: red;
} .slide:nth-of-type(2){
background: orange;
} .slide:nth-of-type(3){
background: green;
} .slide:nth-of-type(4){
background: blue;
} .slide:nth-of-type(5){
background: purple;
}