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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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

              
                <nav>
	<!--Shows our position on the timeline-->
	<div class="marker"></div>
	
	<!--Draggable element-->
	<div class="nav__track" data-draggable>
		<ul class="nav__list">
			<li>
				<a href="#section_1" class="nav__link" data-link><span>1993</span></a>
			</li>
			<li>
				<a href="#section_2" class="nav__link" data-link><span>1995</span></a>
			</li>
			<li>
				<a href="#section_3" class="nav__link" data-link><span>1997</span></a>
			</li>
			<li>
				<a href="#section_4" class="nav__link" data-link><span>2000</span></a>
			</li>
			<li>
				<a href="#section_5" class="nav__link" data-link><span>2001</span></a>
			</li>
			<li>
				<a href="#section_6" class="nav__link" data-link><span>2003</span></a>
			</li>
			<li>
				<a href="#section_7" class="nav__link" data-link><span>2007</span></a>
			</li>
			<li>
				<a href="#section_8" class="nav__link" data-link><span>2011</span></a>
			</li>
			<li>
				<a href="#section_9" class="nav__link" data-link><span>2016</span></a>
			</li>
		</ul>
	</div>
</nav>

<main>
	<section id="section_1" style="--i: 0">
		<h2 class="section__heading">1993</h2>
	</section>
	<section id="section_2" style="--i: 1">
		<h2 class="section__heading">1995</h2>
	</section>
	<section id="section_3" style="--i: 2">
		<h2 class="section__heading">1997</h2>
	</section>
	<section id="section_4" style="--i: 3">
		<h2 class="section__heading">2000</h2>
	</section>
	<section id="section_5" style="--i: 4">
		<h2 class="section__heading">2001</h2>
	</section>
	<section id="section_6" style="--i: 5">
		<h2 class="section__heading">2003</h2>
	</section>
	<section id="section_7" style="--i: 7">
		<h2 class="section__heading">2007</h2>
	</section>
	<section id="section_8" style="--i: 8">
		<h2 class="section__heading">2011</h2>
	</section>
	<section id="section_9" style="--i: 9">
		<h2 class="section__heading">2016</h2>
	</section>
</main>
              
            
!

CSS

              
                * {
	box-sizing: border-box;
}

body {
	--activeColor: rgb(240 240 240);
	--navBgColor: rgb(37 38 41);
	--navTextColor: rgb(144 144 150);
	--mainBg: rgb(20 20 23);
	
	font-family: 'Syncopate', sans-serif;
	min-height: 100vh;
	margin: 0;
	color: var(--navBgColor);
	background: var(--mainBg);
}

section {
	--h: calc(var(--i) * 30);
	
	min-height: 100vh;
	padding: 8rem 1rem max(5vh, 2rem) 1rem;
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: hsl(var(--h, 0) 75% 60%);
}

nav {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	background: var(--navBgColor);
	color: var(--navTextColor);
	z-index: 2;
	height: 6rem;
	
	&::after {
		content: '';
		position: absolute;
		top: 1.7rem;
		left: 0;
		width: 100%;
		height: 0.25rem;
		background: currentColor;
		pointer-events: none;
	}
}

.marker {
	position: fixed;
	top: 1.75rem;
	left: 4rem;
	width: 1rem;
	height: 1rem;
	transform: translate3d(-50%, -50%, 0);
	background: var(--activeColor);
	border-radius: 100%;
	z-index: 2000;
}

.nav__track {
	position: relative;
	min-width: max(200rem, 200%);
	padding: 1.5rem max(100rem, 100%) 0 0;
	height: 6rem;
}

.nav__list {
	list-style: none;
	display: flex;
	justify-content: space-between;
	margin: 0;
	padding: 0;
}

.nav__link {
	position: relative;
	display: block;
	min-width: 8rem;
	padding: 2.25rem 1rem 0.5rem;
	text-align: center;
	color: inherit;
	text-decoration: none;
	z-index: 1;
	transition: color 150ms;
	
	&:hover,
	&:focus {
		color: var(--activeColor);
		text-decoration: underline;
	}
	
	&::after {
		content: '';
		position: absolute;
		top: 0;
		left: 50%;
		width: 0.65rem;
		height: 0.65rem;
		background-color: currentColor;
		border-radius: 50%;
		transform: translate3d(-50%, 0, 0);
		transform-origin: center center;
	}
	
	span {
		display: block;
	}
}

.section__heading {
	font-size: clamp(2rem, 12vmin, 7rem);
	line-height: 1;
	letter-spacing: -0.06em;
}
              
            
!

JS

              
                const sections = gsap.utils.toArray('section')
const track = document.querySelector('[data-draggable]')
const navLinks = gsap.utils.toArray('[data-link]')

const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)')

              
            
!
999px

Console