123

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="slider-container"  aria-labelledby="carouselheading">
  <!-- stop the slider animation -->
  <input  id="slider-paused" name="to-img" type="radio" value="Animation anhalten" class="visuallyhidden">
  <label for="slider-paused">Animation anhalten</label>
  <input  id="slider-running" name="to-img" type="radio" value="Animation fortsetzen" class="visuallyhidden">
  <label for="slider-running">Animation fortsetzen</label>

  <!-- chose a certain image AND stop the slider animation -->
  <input  id="to-img001" name="to-img" type="radio" value="1. Bild" class="visuallyhidden">
  <label for="to-img001">Zum ersten Bild</label>
  <input  id="to-img002" name="to-img" type="radio" value="2. Bild" class="visuallyhidden">
  <label for="to-img002">Zum zweiten Bild</label>
  <input  id="to-img003" name="to-img" type="radio" value="3. Bild" class="visuallyhidden">
  <label for="to-img003">Zum dritten Bild</label>
  <input  id="to-img004" name="to-img" type="radio" value="4. Bild" class="visuallyhidden">
  <label for="to-img004">Zum vierten Bild</label>

  <!-- restart animation slider animation -->
  <input type="radio" name="to-img" id="start-again" value="Slider neu starten" class="visuallyhidden" checked="checked">
  <label for="start-again">Slider neu starten</label>

  <!-- As an Alternative: remove all the inputs above and give the option to pause/run the animation with the following code -->
  <!-- <input type="checkbox" name="toggle-pause" id="toggle-pause" class="toggle-pause visuallyhidden">
  <label for="toggle-pause" class="toggleAnimationBtn">Animation starten/stoppen</label> -->
  <h1 id="carouselheading">Dia-Show</h1> <!-- informiert z.B. Blinde über das, was folgt, kann per CSS ggfs. vor Sehenden versteckt werden. Beschreibt den Container, der den Slider enthält. Die Zuordnung findet mittels aria-labelledby und id statt -->
  <ul tabindex="0" class="slider">
    <li id="meaningOf1stChild">
      <a href="#">Link eins mit etwas Lorem ipsum um mehrere Zeilen zu erzwingen</a>
      <a class="cta">weiter zu Link 1</a>
    </li>
    <li id="meaningOf2ndChild">
      <a href="#">Link zwei</a>
      <a class="cta">weiter zu Link 2</a>
    </li>
    <li id="meaningOf3rdChild">
      <a href="#">Link drei wieder mit ein wenig mehr Text</a>
      <a class="cta">weiter zu Link 3</a>
    </li>
    <li id="meaningOf4thChild">
      <a href="#">Link vier hat eine individuelle Beschreibung</a>
      <a class="cta">weiter zu Link 4</a>
    </li>
    <!-- beliebig viele ergänzen -->
  </ul>
</div>
<h1>Weitere Inhalte</h1> <!-- informiert z. B. blinde Nutzer, dass ein neuer Inhalt beginnt, die Dia-Show also zu ende ist, s.a. https://www.w3.org/WAI/tutorials/carousels/structure/ -->
            
          
!
            
              /* Slider 
   ============================================================== */

.slider-container {
  text-align: center;
}

/* Slider Controls (start/stop animation and slide choser)  
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/* Start/Stop the animation  - - - - - - - - - - - - - - - - - - */

/* starting/stopping the slider */
input#slider-paused:checked ~ .slider li,
ul:focus li,
ul:hover li {
  animation-play-state: paused;
}
input#slider-running:checked ~ .slider li {
  animation-play-state: running;
}
[name="to-img"] + label {
  display: inline-block;
  margin: .5em;
  padding: .5em 1em;
  border: .0625em solid grey;
  border-radius: .5em;
}
[name="to-img"]:focus + label,
[name="to-img"]:hover + label {
  box-shadow: -2px -2px 4px green inset;
}
[name="to-img"] + label::after {
  content: '';
  position: relative;
  left: 0;
  top: .0625rem;
  display: inline-block;
  margin: 0 .5rem;
  border: .0625rem solid black;
  width: 1rem;
  height: 1rem;
  line-height: 1rem;
}
[name="to-img"]:checked + label::after {
  content: 'X';
  font-weight: bold;
  font-size: 2em;
  font-family: sans-serif;
}

/* The  Slider itself   - - - - - - - - - - - - - - - - - - - - - */

.slider {
  list-style-type: none;
  height: 50vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.slider:focus,
.slider:hover {
  box-shadow: 0 0 0 10px blue;
}
@keyframes slide {
    0%     {top: 0}
    12.5%  {top: 0}
    25%    {top: -100%}
    37.5%  {top: -100%}
    50%    {top: -200%}
    62.5%  {top: -200%}
    75%    {top: -300%}
    87.5%  {top: -300%}
    100%   {top: 0}
}
.slider li {
  position: relative;
  top: 0;
  left: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: center;
  height: 100%;
  width: 40%;
  min-width: 15em;
  max-width: 30em;
  margin-left: 10vw;
  background: rgba(0, 0, 0, 0.25);
  animation-name: slide;
  animation-duration: 24s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
  animation-play-state: running;
}
input:nth-of-type(3):checked ~ .slider li {
  top: 0;
  animation-name: no-valid-animation;
}
input:nth-of-type(4):checked ~ .slider li {
  top: -100%;
  animation-name: no-valid-animation;
}
input:nth-of-type(5):checked ~ .slider li {
  top: -200%;
  animation-name: no-valid-animation;
}
input:nth-of-type(6):checked ~ .slider li {
  top: -300%;
  animation-name: no-valid-animation;
}
input:nth-of-type(7):checked ~ .slider li {
  top: -400%;
  animation-name: no-valid-animation;
}
input:nth-of-type(8):checked ~ .slider li {
  top: -500%;
  animation-name: no-valid-animation;
}
input:nth-of-type(9):checked ~ .slider li {
  top: -600%;
  animation-name: no-valid-animation;
}
input:nth-of-type(10):checked ~ .slider li {
  top: -700%;
  animation-name: no-valid-animation;
}
input#start-again:last-of-type:checked ~ .slider li {
  top: 0;
  animation-name: slide;
}

.slider li:before {
  content: '';
  display: block;
  position: absolute;
  left: -10vw;
  top: 0;
  background: url('http://www.placehold.it/1400x500?text=Standard-Hintergrund+(Fallback)') no-repeat center;
  background-size: cover;
  width: 100vw;
  height: 50vh;
  z-index: -1;
}
.slider li:nth-child(1):before {
  background-image: url(http://www.placehold.it/1400x500/ffaaaa);
}
.slider li:nth-child(2):before {
  background-image: url(http://www.placehold.it/1400x500/aaffaa);
}
.slider li:nth-child(3):before {
  background-image: url(http://www.placehold.it/1400x500/aaaaff);
}
.slider .cta,
.slider a {
  flex: 1 0 51%;
  margin: 1rem;
  padding: .5rem 1rem;
  background: rgba(0, 0, 0, 0.5);
}
.slider a {
  font-size: 2em;
  text-decoration: none;
  text-shadow: 1px 1px black;
  color: white;
}
.slider .cta {
  color: black;
  border: 1px solid grey;
  background-color: #fff;
}



/* Helper classes 
   ============================================================== */

.visuallyhidden {
		border: 0;
		clip: rect(0 0 0 0);
		height: 1px;
		margin: -1px;
		overflow: hidden;
		padding: 0;
		position: absolute;
		width: 1px;
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console