cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              .card
  p.copy Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil sunt delectus facilis iste dignissimos, quidem, error, itaque beatae dolorum quos, maiores. Voluptate dolorum rem voluptatum adipisci veritatis fuga, ducimus magni.
  button.button(data-tour="2" data-tour-helper="Find out what it is all about")  Explore the app
  
.card
  img(src="http://placehold.it/100" data-tour="6" data-tour-helper="What is this picture doing here?")
  button.button(data-tour="1" data-tour-helper="Take a tour through the app")  Take a tour
  p.copy Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil sunt delectus facilis iste dignissimos, quidem, error, itaque beatae dolorum quos, maiores. Voluptate dolorum rem voluptatum adipisci veritatis fuga, ducimus magni.
  button.button(data-tour="10" data-tour-helper="uuhh.. clicky clicky button.") Don't click me
  
.card
  p.copy Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil sunt delectus facilis iste dignissimos, quidem, error, itaque beatae dolorum quos, maiores. Voluptate dolorum rem voluptatum adipisci veritatis fuga, ducimus magni.
  button.button(data-tour="11" data-tour-helper="That's it. Enjoy the app") Say goodbye  
  p.copy  Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil sunt delectus facilis iste dignissimos, quidem, error, itaque beatae dolorum quos, maiores. Voluptate dolorum rem voluptatum adipisci veritatis fuga, ducimus magni.
  img(src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/28359/uglyguy.jpg" data-tour="3" data-tour-helper="Oh how pretty. is that picture a photo of you?")
 

    
    
#tour
  .tour-overlay
    .tour-cover
      .side
      .side
      .side 
      .side
  .tour-content Welcome to the Tour
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Roboto:400,300,500,700);
body, button, input {
  font-family: Roboto;
}
body {
  overflow: hidden;
}
.card {
  margin: 20px auto;
  min-width: 200px;
  max-width: calc(90% - 20px);
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
  box-shadow: 0 3px 7px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.3);
  
  button {
    background: #47adb2;
    color: #fff;
    text-transform: uppercase;
    font-size: 14px;
    border: 0;
    border-radius: 2px;
    padding: 12px 16px;
    margin: 10px;
    min-width: max-content;
    cursor: pointer;
    
    &:hover {
    background: mix(black,#47adb2,20%);

    }
  }
  
  .copy {
    font-size: 14px;
    flex: 1 1 50%;
  }
}


#tour {
  position: fixed;
  z-index: 9999;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  visibility: hidden;
  
  .tour-overlay {
    height: 0; 
    width: 0;
    border-radius: 100%;
    position: absolute;
    visibility: visible;
    transform: translate(-50%,-50%);
    transition-property: height,width,box-shadow;
    transition-duration: 0.25s,0.25s,0.5s;
    transition-delay: 0.25s,0.25s,0.75s;
    
    top: 50%;
    left: 50%;
    box-shadow: 0 0 0 120vmax rgba(black,0.9);
  }
  
  .tour-content {
    visibility: visible;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    display: flex;
    align-items: center;
    align-content: center;
    justify-content: center;
    padding: 30px;
    box-sizing: border-box;
    font-size: 2em;
    font-weight: 300;
    color: white;
  }
  .tour-cover {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    
    .side {
      position: absolute;
      height: 100vmax;
      width: 100vmax;
      visibility: visible;
      pointer-events: all;
      
      &:nth-child(1) {
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
      }
      &:nth-child(2) {
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
      }
      &:nth-child(3) {
        top: 50%;
        left: 100%;
        transform: translateY(-50%);
      }
      &:nth-child(4) {
        top: 50%;
        right: 100%;
        transform: translateY(-50%);
      }
    }
  }
}
            
          
!
            
              var steps = document.querySelectorAll('[data-tour]');
var overlay = document.querySelector('.tour-overlay');
var content = document.querySelector('.tour-content');
var cover = document.querySelector('.tour-cover');


var arr = [];
var map = {};
Array.prototype.forEach.call(steps,(step, index)=>{
  var id = step.getAttribute('data-tour');
  arr.push(id);
  map[id] = step
});

arr.sort((a, b) => {
  return a - b;
});

var items = arr.map((item,index)=>{
    return map[item];
});

items.forEach((step, index)=>{
  setTimeout(()=>{
    let helper = step.getAttribute('data-tour-helper');
    let b =  step.offsetHeight/2;
    let c = step.offsetWidth/2;
    let a = a = Math.sqrt(Math.pow(b,2) + Math.pow(c,2) - 2 * b * c * Math.cos(0.5*Math.PI))
    let data = {
      top: `${step.offsetTop - window.scrollY + b}px`,
      left: `${step.offsetLeft - window.scrollX + c}px`,
      size: a*2,
    }
    //overlay.style.top = data.top;
    //overlay.style.left = data.left;
    overlay.style.width = 0;
    overlay.style.height = 0;
    overlay.style.boxShadow = `0 0 0 ${100 * Math.sqrt(2)}vmax hsla(${index*40},80%,40%,0.9)`;
    content.innerText = '';
    
    setTimeout(()=>{
      content.innerText = helper;
      cover.style.height = `${b*2}px`;
      cover.style.width = `${c*2}px`;
      overlay.style.top = data.top;
      overlay.style.left = data.left;
      overlay.style.width = `${data.size}px`;
      overlay.style.height = `${data.size}px`;
    },1000);
    
    if (parseInt(data.left,10)>window.innerWidth/2) {
      content.style.left = `0%`
    } else {
       content.style.left = `50%`
    }
  },5000*index + 1000);
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console