Pen Settings

HTML

CSS

CSS Base

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

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.

Vue

              
                <template>
	<div class="page">
		<nav class="page-nav">
			<div
				class="page-nav__item"
				v-for="nav in pages"
				:class="{ '-active': active === nav }"
				@click="move(nav)"
			>
				<span>{{ nav }}</span> <sup></sup>
			</div>
		</nav>

		<transition
			name="page-transition"
			:enter-active-class="'page-transition-enter-active ' + directionClass"
			:leave-active-class="'page-transition-leave-active ' + directionClass"
		>
			<div
				class="page-content"
				:class="[active.toLowerCase()]"
				:is="'page' + active"
				:name="active"
			></div>
		</transition>

		<p class="page-notes">
			<u>Navigation</u>: Click the navigation or you can use up and down from
			keyboard. Also keypad works.
		</p>
	</div>
</template>

<script>
var pageTemplate = {
	props: ["name"],
	template: `
		<section>{{name}}</section>
	`
};

export default {
	components: {
		pageOne: pageTemplate,
		pageTwo: pageTemplate,
		pageThree: pageTemplate,
		pageFour: pageTemplate
	},
	data() {
		return {
			pages: ["One", "Two", "Three", "Four"],
			active: "One",
			directionClass: "-next"
		};
	},
	mounted() {
		document.addEventListener("keyup", this.navigation);
	},
	methods: {
		direction(nav) {
			let vm = this;
			let currentIndex = vm.pages.findIndex((item) => item == vm.active);
			let nextIndex = vm.pages.findIndex((item) => item == nav);
			return currentIndex < nextIndex ? "-next" : "-previous";
		},
		move(nav) {
			this.directionClass = this.direction(nav);
			this.active = nav;
		},
		navigation(event) {
			let vm = this;
			let length = vm.pages.length;
			let currentIndex = vm.pages.findIndex((item) => item == vm.active);

			if (currentIndex > 0 && event.keyCode == 38) {
				vm.move(vm.pages[currentIndex - 1]);
			}

			if (currentIndex < length - 1 && event.keyCode == 40) {
				vm.move(vm.pages[currentIndex + 1]);
			}

			if (
				(event.keyCode >= 48 && event.keyCode <= 57) ||
				(event.keyCode >= 96 && event.keyCode <= 105)
			) {
				if (parseInt(event.key) <= length) {
					let key = parseInt(event.key) === 0 ? 1 : event.key;
					vm.move(vm.pages[key - 1]);
				}
			}
		}
	}
};
</script>

<style lang="scss">
*,
*:before,
*:after {
	box-sizing: border-box;
}

:root {
	--rem: 18px;
	counter-reset: nav;
}

html,
body {
	all: initial;
	box-sizing: border-box;

	margin: 0;
	padding: 0;
	width: 100vw;
	min-height: 100vh;

	display: flex;
	flex-direction: column;
	justify-content: stretch;
	align-items: stretch;

	background-color: white;

	font-family: "Spartan", sans-serif;
	font-variation-settings: "wght" 400;
	font-size: var(--rem);
}

.page {
	flex-grow: 1;

	perspective: 1200px;
	overflow: hidden;

	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	align-items: stretch;

	&-nav {
		flex-grow: 0;
		position: absolute;
		left: 50%;
		top: 80%;
		transform: translate(-50%, -80%);
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		z-index: 40;

		&__item {
			margin: 0 6px;
			min-width: 65px;
			color: white;
			font-family: "Spartan", sans-serif;
			font-variation-settings: "wght" 400;

			text-decoration: none;
			text-align: center;
			white-space: nowrap;

			cursor: pointer;
			transition: font-weight 0.45s ease-out;

			& sup:after {
				counter-increment: nav;
				content: "(" counter(nav) ")";
				font-size: 0.6rem;
				font-variation-settings: "wght" 400;
				line-height: 0.8rem;
			}

			&:hover {
				font-variation-settings: "wght" 500;
			}

			&.-active span {
				text-decoration: underline;
				font-variation-settings: "wght" 500;
			}
		}
	}

	&-content {
		position: absolute;
		top: 0;
		left: 0;

		width: 100%;
		height: 100%;

		flex-grow: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		background-color: white;

		font-family: "Spartan", sans-serif;
		font-variation-settings: "wght" 900;
		font-size: 20vw;
		letter-spacing: 2.2vw;
		text-transform: uppercase;

		&.one {
			background-color: rgb(94, 80, 142);
			color: rgba(255, 225, 255, 0.2);
		}
		&.two {
			background-color: rgb(178, 202, 200);
			color: rgba(255, 225, 255, 0.6);
		}
		&.three {
			background-color: rgb(203, 192, 211);
			color: rgba(255, 225, 255, 0.6);
		}
		&.four {
			background-color: rgb(255, 214, 186);
			color: rgba(255, 225, 255, 0.8);
		}
	}

	&-notes {
		position: absolute;
		bottom: 20px;
		right: 20px;

		margin: 0;
		padding: 10px;

		width: 320px;

		border-radius: 8px;
		color: white;
		font-size: 0.6rem;
		font-variation-settings: "wght" 400;
		line-height: 0.8rem;

		background-color: rgba(0, 0, 0, 0.6);
	}

	&-transition {
		$transition: &;
		&-leave {
			z-index: 20;
			&-active {
				&.-next {
					animation: slideOutUp 1s both ease;
					& ~ #{$transition}-enter-active {
						animation: slideInUp 1s both ease;
					}
				}
				&.-previous {
					animation: slideOutDown 1s both ease;
					& ~ #{$transition}-enter-active {
						animation: slideInDown 1s both ease;
					}
				}
			}
		}
	}
}

@keyframes slideOutUp {
	25% {
		opacity: 0.6;
		transform: translateZ(-100px);
		border-radius: 20px;
		font-variation-settings: "wght" 400;
		font-size: 16vw;
	}
	75% {
		opacity: 0.6;
		transform: translateZ(-100px) translateY(-200%);
		border-radius: 20px;
	}
	100% {
		opacity: 0.6;
		transform: translateZ(-100px) translateY(-200%);
	}
}

@keyframes slideInUp {
	0%,
	25% {
		opacity: 0.6;
		transform: translateZ(-100px) translateY(200%);
		border-radius: 20px;
		font-variation-settings: "wght" 400;
		font-size: 16vw;
	}
	75% {
		opacity: 0.6;
		transform: translateZ(-100px);
		border-radius: 20px;
	}
	100% {
		opacity: 1;
		transform: translateZ(0) translateX(0);
	}
}

@keyframes slideOutDown {
	25% {
		opacity: 0.6;
		transform: translateZ(-100px);
		border-radius: 20px;
		font-variation-settings: "wght" 400;
		font-size: 16vw;
	}
	75% {
		opacity: 0.6;
		transform: translateZ(-100px) translateY(200%);
		border-radius: 20px;
	}
	100% {
		opacity: 0.6;
		transform: translateZ(-100px) translateY(200%);
	}
}

@keyframes slideInDown {
	0%,
	25% {
		opacity: 0.6;
		transform: translateZ(-100px) translateY(-200%);
		border-radius: 20px;
		font-variation-settings: "wght" 400;
		font-size: 16vw;
	}
	75% {
		opacity: 0.6;
		transform: translateZ(-100px);
		border-radius: 20px;
	}
	100% {
		opacity: 1;
		transform: translateZ(0) translateX(0);
	}
}
</style>

              
            
!
999px

Console