slideshow.csson commit initialise listeners in JS, set heights at runtime, add readme (a0b380c)
   1:root {
   2  --sl-cap: 20px;
   3  --sl-dots: 10px;
   4  --sl-transition: 0.5s;
   5}
   6
   7div.slideshow {
   8  max-width: 1000px;
   9  position: relative;
  10  margin: auto;
  11}
  12
  13
  14/* 
  15 * Slides
  16 */
  17
  18figure.slide:first-child {
  19  /* Position the first slide relatively to set the height (others are 
  20   * positioned absolutely to allow overlapping) */
  21  position: relative;
  22}
  23
  24figure.slide {
  25  /* Position slides absolutely to allow overlapping */
  26  text-align: center;
  27  position: absolute;
  28  top: 0;
  29  left: 0;
  30  width: 100%;
  31  margin: 0;
  32  /* Slides start at 0 opacity */
  33  opacity: 0;
  34  /* Fade out duration is double the fade in duration (approximates a cross 
  35   * dissolve) */
  36  transition: opacity calc(2 * var(--sl-transition)) ease;
  37  -webkit-transition: opacity calc(2 * var(--sl-transition)) ease;
  38  -moz-transition: opacity calc(2 * var(--sl-transition))  ease;
  39  z-index: -1;
  40}
  41
  42figure.slide.active {
  43  opacity: 1;
  44  z-index: 0;
  45  /*display: block;*/
  46  transition: opacity 1s ease;
  47  -webkit-transition: opacity 1s ease;
  48  -moz-transition: opacity 1s ease;
  49}
  50
  51figure.slide img {
  52  max-width: 100%;
  53}
  54
  55
  56/* 
  57 * Buttons
  58 */
  59
  60#prev, #next, #state {
  61  cursor: pointer;
  62  font-weight: bold;
  63  font-size: 1.5em;
  64  user-select: none;
  65  opacity: 0;
  66  transition: 0.2s ease;
  67  position: absolute;
  68  color: white;
  69}
  70
  71#prev, #next {
  72  top: calc(50% - calc(var(--sl-cap) + var(--sl-dots) + 50px) / 2);
  73  width: auto;
  74  padding: 16px;
  75}
  76
  77#state {
  78  width: 1.5em;
  79  height: 1.5em;
  80  text-align: center;
  81  font-family: monospace;
  82  top: 15px;
  83  right: 15px;
  84  padding: 4px;
  85  border-radius: 3px;
  86}
  87
  88#prev {
  89  left: 0;
  90  border-radius: 0 3px 3px 0;
  91}
  92
  93#next {
  94  /* Position next button on right */
  95  right: 0;
  96  border-radius: 3px 0 0 3px;
  97}
  98
  99div.slideshow:hover #prev,
 100div.slideshow:hover #next,
 101div.slideshow:hover #state {
 102  /* Show buttons on slideshow hover */
 103  opacity: 100;
 104  background-color: rgba(0,0,0,0.3);
 105}
 106
 107#prev:hover, #next:hover, #state:hover {
 108  /* Button hover */
 109  background-color: rgba(0,0,0,0.8) !important;
 110}
 111
 112
 113/* 
 114 * Dot controls/indicators
 115 */
 116
 117div.slideshow div#controls {
 118  text-align: center;
 119  width: 100%;
 120}
 121
 122div.slideshow div#controls span {
 123  cursor: pointer;
 124  height: var(--sl-dots);
 125  width: var(--sl-dots);
 126  margin: 0 2px;
 127  background-color: #bbb;
 128  border-radius: 50%;
 129  display: inline-block;
 130  transition: background-color 0.6s ease;
 131}
 132
 133div#controls span.active,
 134div#controls span:hover {
 135  background-color: #717171 !important;
 136}