Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                <body><h1> Welcome to my blog</h1>
 
<div class="slider">
  <div class="indicatorContainer">
  <div id="indicator1"></div>
  <div id="indicator2"></div>
  <div id="indicator3"></div>
  </div>
  <div class="BtnContainer">
  <button class="forward" onclick="setImgIndex(1)"></button>
  <button class="backward" onclick="setImgIndex(-1)"></button>
  </div>
<div class="backgroundimages">
  
  <img  src="https://static.pexels.com/photos/226243/pexels-photo-226243.jpeg" alt="alte Kamera">
   <img  src="https://static.pexels.com/photos/7882/light-bulb-light-old.jpg" alt="Glühbirne">
   <img src="https://static.pexels.com/photos/85886/lamp-finger-touch-hand-85886.jpeg" alt="Finger, der auf Glühbirne zeigt">
 
  
  </div>
  </div></body>
              
            
!

CSS

              
                h1 {
  text-align: center;
  text-transform: uppercase;
  color: white;
  padding-bottom: 10px;
  font-size: 40pt;
  font-weight: 100;
  letter-spacing: 4pt;
}

body {
  margin-bottom: 50px;
  font-family: montserrat;
  background: #1f1f1f;
}

.BtnContainer{
  display:flex;
  justify-content:space-between;
  flex-flow: row nowrap;
  width:100%;
}

img {
  height: 500px;
  width: 800px;
}

.indicatorContainer{
  display:flex;
  flex-direction:row;
  justify-content:space-around;
  position:absolute;
  width:70px;
  height:5px;
  left:435px;
  top:615px;
}

#indicator1, #indicator2, #indicator3{
  border:5px solid white;
  border-radius:50%;
  transition: all ease-in-out 0.5s;
  
}

.backgroundimages {

  transition: all ease-in-out 1s;
  display: flex;
  flex-flow: row nowrap;
  justify-content: flex-start;
}

button{
  border-radius:0;
}

button:hover {
  cursor: pointer;
  opacity: 0.8;
}

.slider {
  height: 600px;
  width: 800px;
  overflow: hidden;
  margin: auto;
}

.forward {
  border: 10px solid white;
  background: white
    url("https://d30y9cdsu7xlg0.cloudfront.net/png/755942-200.png") no-repeat;
  opacity: 0.5;
  background-size: contain;
  position: absolute;
  top: 380px;
  margin-left: 750px;
  padding: 15px;
  box-sizing: border-box;
  transition: all 0.2s ease-in-out;
}

.backward {
  overflow: hidden;
  border: 10px solid #fff;
  background: white
    url("https://d30y9cdsu7xlg0.cloudfront.net/png/755953-200.png") no-repeat
    0px;
  background-size: contain;
  color: none;
  opacity: 0.5;
  position: absolute;
  top: 380px;
  padding: 15px;
  box-sizing: border-box;
  transition: all 0.2s ease-in-out;
}

              
            
!

JS

              
                var imgIndex = 0;
var distance = -800;
var imgSelector = document.querySelector(".backgroundimages");
var indicator1Active = document.querySelector("#indicator1");
var indicator2Active = document.querySelector("#indicator2");
var indicator3Active = document.querySelector("#indicator3");
updateIndicators();


function setImgIndex(d) {
  imgIndex = imgIndex + d;
  if (imgIndex > 2) {
    imgIndex = 0;
  } else if (imgIndex < 0) {
    imgIndex = 2;
  }

  imgSelector.style.marginLeft = distance * imgIndex + "px";
  updateIndicators();
}

function updateIndicators() {
  switch (imgIndex) {
    case 1:
      indicator1Active.style.opacity = "0.3";
      indicator2Active.style.opacity = "0.8";
      indicator3Active.style.opacity = "0.3";
      break;
    case 2:
      indicator1Active.style.opacity = "0.3";
      indicator2Active.style.opacity = "0.3";
      indicator3Active.style.opacity = "0.8";
      break;
    default:
      indicator1Active.style.opacity = "0.8";
      indicator2Active.style.opacity = "0.3";
      indicator3Active.style.opacity = "0.3";
      
  }
}

              
            
!
999px

Console