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="panels">
	<div class="panel">
		<div class="panel-body">
			<div class="spinner1"></div>
			<div class="navigation">
				<a href="#" data-target="right" class="nav-right"><i class="fa fa-arrow-right"></i></a>
			</div>
		</div>
	</div>
	<div class="panel">
		<div class="panel-body">
			<div class="spinner2"></div>
			<div class="navigation">
				<a href="#" data-target="left" class="nav-left"><i class="fa fa-arrow-left"></i></a>
				<a href="#" data-target="right" class="nav-right"><i class="fa fa-arrow-right"></i></a>
			</div>
		</div>
	</div>
	<div class="panel">
		<div class="panel-body">
			<div class="spinner3"></div>
			<div class="navigation">
				<a href="#" data-target="left" class="nav-left"><i class="fa fa-arrow-left"></i></a>
				<a href="#" data-target="right" class="nav-right"><i class="fa fa-arrow-right"></i></a>
			</div>
		</div>
	</div>
	<div class="panel">
		<div class="panel-body">
			<div class="spinner4"></div>
			<div class="navigation">
				<a href="#" data-target="left" class="nav-left"><i class="fa fa-arrow-left"></i></a>
				<a href="#" data-target="right" class="nav-right"><i class="fa fa-arrow-right"></i></a>
			</div>
		</div>
	</div>
	<div class="panel">
		<div class="panel-body">
			<div class="b-container">
				<span class="ball"></span>
				<span class="ball"></span>
				<span class="ball"></span>
			</div>
			<div class="navigation">
				<a href="#" data-target="left" class="nav-left"><i class="fa fa-arrow-left"></i></a>
				<a href="#" data-target="right" class="nav-right"><i class="fa fa-arrow-right"></i></a>
			</div>
		</div>
	</div>
	<div class="panel">
		<div class="panel-body">
			<div class="bars-container">
				<span class="bar"></span>
				<span class="bar"></span>
				<span class="bar"></span>
			</div>
			<div class="navigation">
				<a href="#" data-target="left" class="nav-left"><i class="fa fa-arrow-left"></i></a>
			</div>
		</div>
	</div>
</div>
            
          
!
            
              /* Spinners */
/* Spinner 1 */
.spinner1 {
    width: 50px;
    height: 50px;
    border-width: 3px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
    border-radius: 50%;
    animation: spinner1 1s linear infinite;
}

@keyframes spinner1 {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Spinner 2 */
.spinner2 {
    width: 50px;
    height: 50px;
    border: 3px solid #fff;
    border-color: #fff transparent #fff transparent;
    border-radius: 50%;
    animation: spinner2 1s linear infinite;
}

@keyframes spinner2 {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Spinner 3 */
.spinner3 {
    width: 50px;
    height: 50px;
    border: 3px solid #fff;
    border-color: #fff transparent #fff transparent;
    border-radius: 50%;
    animation: spinner3 1s linear infinite;
}

@keyframes spinner3 {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(.5);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Spinner 4 */
.spinner4 {
    width: 50px;
    height: 50px;
    border: 3px solid #fff;
    border-color: #fff transparent #fff transparent;
    border-radius: 50%;
    animation: spinner4 1s linear infinite;
}

@keyframes spinner4 {
    0% {
        transform: rotate(0deg);
    }
    20% {
        transform: rotate(150deg);
    }
    80% {
        transform: rotate(210deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Jumping ball */
.b-container {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 60px;
	flex-direction: row;
}
.b-container .ball{
	background-color: #fff;
	border-radius: 50%;
	display: block;
	width: 15px;
	height: 15px;
	animation: jump .7s ease-in-out infinite;
}

.b-container .ball:nth-child(2) {
	animation-delay: .15s;
}

.b-container .ball:nth-child(3) {
	animation-delay: .3s;
}

@keyframes jump {
	0%, 100% {
		transform: translateY(0);
	}
	
	50% {
		transform: translateY(-20px);
	}
}

/* Bars style */
.bars-container {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 40px;
	flex-direction: row;
}

.bar {
	background-color: #fff;
	height: 50px;
	width: 10px;
	display: block;
	animation: increase 1s ease-in-out infinite;
}

.bar:nth-child(2) {
	animation-delay: .25s;
}

.bar:nth-child(3) {
	animation-delay: .5s;
}

@keyframes increase {
	0%, 100% {
		transform: scaleY(1);
	}
	
	50% {
		transform: scaleY(0.6);
	}
}

/* Body and panels style */
body {
	margin: 0;
	position: relative;
    height: 100vh;
}

.panel {
	background-image: linear-gradient(90deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
	position: absolute;
	top: 0;
	left: 0;
	width: 100vw;

	transform: translateX(100vw);
    transition: transform .7s ease-in-out;
}

.panel-body {
	height: 100vh;
	display: flex;
	justify-content: center;
	align-items: center;
}

.panel:first-of-type {
	transform: translateX(0);
}

/* Navigation */
.navigation a{
    color: white;
    font-size: 30px;
    position: fixed;
    top: 50%;

    transform: translateY(-50%);
}

.navigation a:hover {
    text-decoration: none;
}

.navigation a.nav-left {
    left: 10px;
    right: auto;
}

.navigation a.nav-right {
    left: auto;
    right: 10px;
}

            
          
!
            
              let panel_navigation = document.querySelectorAll('.navigation');

panel_navigation.forEach((pn, idx) => {
    for(let i=0; i<pn.children.length; i++) {
        pn.children[i].addEventListener('click', function() {
            // get parent panel
            let parent_panel = this.parentNode.parentNode.parentNode;

            // add active class to corresponding panel
            if(this.dataset.target === 'left') {
                parent_panel.previousElementSibling.style.transform = 'translateX(0)';
                parent_panel.style.transform = 'translateX(100vw)';
            } else if(this.dataset.target === 'right') {
                parent_panel.nextElementSibling.style.transform = 'translateX(0)';
                parent_panel.style.transform = 'translateX(-100vw)';
            }
        });
    }
});

            
          
!
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