Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!doctype html>
<html>
  <head>
    
    
  </head>
  <body>
    <h1>Images Slider Eigenbau</h1>

<main> 
 </main>
<div id="buttonbox">
<input type="button" id="minus" value="minus">
 <input type="button" id="auto" value="automatik">  
    <input type="button" id="aus" value="Stop">
    <input type="button" id="plus" value="plus">
    </div>
    
    

  </body>
</html>
              
            
!

CSS

              
                *{
  
  margin:0;
  padding:0;
/*border:1px solid red;*/
}
body{
  display:flex;
  text-align:center;
  flex-direction:column;
  height:100vh;
}
h1{
  text-align:center;
  display:flex;
  flex-direction:column;
  padding:20px 0;
  text-decoration:underline;
}
#sliderbox{
  display:flex;
  width:80vw;
  flex:10;
  margin:0px auto;
}
figure{
  border:3px solid black;
  border-radius:20px;
}
#buttonbox{
  width:80vw;
  margin:0px auto;
  display:flex;
  flex:1;
}
#buttonbox > *{
  flex:1;
  height:30px;
}
.slider{
  width:100%;
  overflow:hidden;
  flex-direction:column;
}
.textfeld{
  text-align:center;
  padding:3px 10px 3px 10px;
  font-weight:900;
  height:70px;
  overflow: hidden;
}

#aus{
  display:none;
}
              
            
!

JS

              
                var images=[2,3,4,5,6,7,8,9];//oder kompletter links
var komplette_link=false;// false oder true
var auto_speed=2000;
var texte=['1Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut'
,'2Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut','3jjjjLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut','4jjjjLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut','5fgsdrthLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt utLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor','6fgdgLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut','7sdfghjk','8sdfgbhn'];
var stop;
ma=document.createElement('div');
ma.id='sliderbox';
menge=images.length;
for(g=0;g<=menge-1;g++){
    if(komplette_link==true){
     var links_aus_array=images[g];
    }else{
     var links_aus_array='http://sebastian1012.bplaced.net/bilder/'+images[g]+'.jpg';
    }
ma.innerHTML+='  <figure class="slider"><img  src="'+links_aus_array+'" style="width:100%"><figcaption class="textfeld"><p>'+texte[g]+'</p></figcaption>  </figure>';
  document.getElementsByTagName('main')[0].appendChild(ma);
}

var slideIndex = 1;
showDivs(slideIndex);
function showDivs(n) {
  var i;
  var x = document.getElementsByClassName("slider");
  if (n > menge) {
    slideIndex = 1
  }
  if (n < 1) {
    slideIndex = menge;
  }
  for (i = 0; i < x.length; i++) {
  x[i].style.transition='all 1s ease-in-out';

  x[i].style.opacity = 0; 
         x[i].style.display = 'none';  
  }
  x[slideIndex-1].style.transition='all 1s ease-in-out';
  x[slideIndex-1].style.display = 'flex'; 
  x[slideIndex-1].style.opacity = 1; 
}

document.getElementById('plus').addEventListener('click',function(){
  slideIndex++;
  showDivs(slideIndex)
})

document.getElementById('minus').addEventListener('click',function(){
  slideIndex--;
  showDivs(slideIndex)
})


function automatic(){
    stop=setInterval(function(){
      slideIndex++;
       showDivs(slideIndex)
    },auto_speed)
}
  
var stop_auto=document.getElementById('aus');
var aut=document.getElementById('auto');

aut.addEventListener('click',function(){
  aut.style.display='none';
 stop_auto.style.display='block'; 
        slideIndex++;
       showDivs(slideIndex)
  automatic();
})

stop_auto.addEventListener('click',function(){
   aut.style.display='block';
   stop_auto.style.display='none';
   clearInterval(stop);
});



              
            
!
999px

Console