HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div id="smooth-wrapper">
<div id="smooth-content">
<div class="container">
<section class="panel intro" style="background-image: url('images/panel-intro-bg.jpg')">
<div class="content">
<p class="eyebrow content-fade-in">Timeline Example</p>
<h1 class="content-fade-in">Heading here</h1>
<p class="content-fade-in">
Lorem ipsum dolor sit amet consectetur, adipisicing
elit. Non soluta dignissimos rerum quod quae?
Asperiores, vitae modi placeat nostrum amet mollitia at
eaque nihil ratione expedita distinctio facilis!
Perspiciatis, repellat?
</p>
<p class="content-fade-in">
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Sapiente et numquam voluptates facilis esse alias at
maiores dolor voluptatem laborum, illo animi quod? Dicta
autem illum odio fugiat. Porro, veniam!
</p>
<button href="#" class="button modal-btn content-fade-in" data-target="shareStory">
Button
</button>
</div>
<a href="#storyBoard" class="button-round content-fade-in" id="dragScrollBtn">
Drag or <br />
Scroll
</a>
</section>
<section class="panel story-board" id="storyBoard">
<!-- <div class="overlay preview show">
<div class="button-round interact">
Click to <br />
Interact
</div>
</div> -->
<ul class="years">
<li class="year" id="1993">
<h3>1993</h3>
<ul class="stories has-lodge">
<li class="story lodge">
<div class="inner">
<div class="story-head">
<div class="location">
<h5>Location Name</h5>
<p>Some Country</p>
</div>
<div class="dated">
<span class="opened">Date</span>
<span class="date">
<span>July</span>
<span>
19 <br />
93
</span>
</span>
</div>
</div>
<div class="story-img">
<img src="https://picsum.photos/200/300?random=1" alt="Featured" class="lazyload visi" />
</div>
<div class="excerpt">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime nihil tempora fugiat rem impedit vero. Ipsum, blanditiis molestiae voluptatibus est, porro nisi facilis quo eaque ipsa non laboriosam cum iste.
</div>
</div>
</li>
<li class="story lodge">
<div class="inner">
<div class="story-head">
<div class="location">
<h5>Location Name</h5>
<p>Country</p>
</div>
<div class="dated">
<span class="opened">Date</span>
<span class="date">
<span>July</span>
<span>
19 <br />
93
</span>
</span>
</div>
</div>
<div class="story-img">
<img src="https://picsum.photos/200/300?random=1" alt="Featured" class="lazyload visi" />
</div>
<div class="excerpt">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime nihil tempora fugiat rem impedit vero. Ipsum, blanditiis molestiae voluptatibus est, porro nisi facilis quo eaque ipsa non laboriosam cum iste.
</div>
</div>
</li>
<li class="story">
<a href="#" class="story-link modal-btn" data-target="story-1">
<span class="story-date">
12 Jul 1993
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1993
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1993
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Blake</span>
<span>Some Lodge</span>
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1993
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1993
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1993
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1993
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1993
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
</a>
</li>
</ul>
</li>
<li class="year" id="1994">
<h3>1994</h3>
<ul class="stories">
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1994
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1994
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
</ul>
</li>
<li class="year" id="1995">
<h3>1995</h3>
<ul class="stories has-lodge">
<li class="story lodge">
<div class="inner">
<div class="story-head">
<div class="location">
<h5>Location Name</h5>
<p>Some area</p>
</div>
<div class="dated">
<span class="opened">Date</span>
<span class="date">
<span>July</span>
<span>
19 <br />
95
</span>
</span>
</div>
</div>
<div class="story-img">
<img src="https://picsum.photos/200/300?random=1" alt="Featured" class="lazyload visi" />
</div>
<div class="excerpt">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime nihil tempora fugiat rem impedit vero. Ipsum, blanditiis molestiae voluptatibus est, porro nisi facilis quo eaque ipsa non laboriosam cum iste.
</div>
</div>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
</ul>
</li>
<li class="year" id="1996">
<h3>1996</h3>
<ul class="stories has-lodge">
<li class="story lodge">
<div class="inner">
<div class="story-head">
<div class="location">
<h5>Location Name</h5>
<p>Some area</p>
</div>
<div class="dated">
<span class="opened">Date</span>
<span class="date">
<span>July</span>
<span>
19 <br />
95
</span>
</span>
</div>
</div>
<div class="story-img">
<img src="https://picsum.photos/200/300?random=1" alt="Featured" class="lazyload visi" />
</div>
<div class="excerpt">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime nihil tempora fugiat rem impedit vero. Ipsum, blanditiis molestiae voluptatibus est, porro nisi facilis quo eaque ipsa non laboriosam cum iste.
</div>
</div>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
</ul>
</li>
<li class="year" id="2000">
<h3>2000</h3>
<ul class="stories has-lodge">
<li class="story lodge">
<div class="inner">
<div class="story-head">
<div class="location">
<h5>Location Name</h5>
<p>Some area</p>
</div>
<div class="dated">
<span class="opened">Date</span>
<span class="date">
<span>July</span>
<span>
19 <br />
95
</span>
</span>
</div>
</div>
<div class="story-img">
<img src="https://picsum.photos/200/300?random=1" alt="Featured" class="lazyload visi" />
</div>
<div class="excerpt">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime nihil tempora fugiat rem impedit vero. Ipsum, blanditiis molestiae voluptatibus est, porro nisi facilis quo eaque ipsa non laboriosam cum iste.
</div>
</div>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
</ul>
</li>
<li class="year" id="2003">
<h3>2003</h3>
<ul class="stories has-lodge">
<li class="story lodge">
<div class="inner">
<div class="story-head">
<div class="location">
<h5>Location Name</h5>
<p>Some area</p>
</div>
<div class="dated">
<span class="opened">Date</span>
<span class="date">
<span>July</span>
<span>
19 <br />
95
</span>
</span>
</div>
</div>
<div class="story-img">
<img src="https://picsum.photos/200/300?random=1" alt="Featured" class="lazyload visi" />
</div>
<div class="excerpt">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime nihil tempora fugiat rem impedit vero. Ipsum, blanditiis molestiae voluptatibus est, porro nisi facilis quo eaque ipsa non laboriosam cum iste.
</div>
</div>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
</ul>
</li>
<li class="year" id="2010">
<h3>2010</h3>
<ul class="stories has-lodge">
<li class="story lodge">
<div class="inner">
<div class="story-head">
<div class="location">
<h5>Location Name</h5>
<p>Some area</p>
</div>
<div class="dated">
<span class="opened">Date</span>
<span class="date">
<span>July</span>
<span>
19 <br />
95
</span>
</span>
</div>
</div>
<div class="story-img">
<img src="https://picsum.photos/200/300?random=1" alt="Featured" class="lazyload visi" />
</div>
<div class="excerpt">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime nihil tempora fugiat rem impedit vero. Ipsum, blanditiis molestiae voluptatibus est, porro nisi facilis quo eaque ipsa non laboriosam cum iste.
</div>
</div>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
</ul>
</li>
<li class="year" id="2013">
<h3>2013</h3>
<ul class="stories has-lodge">
<li class="story lodge">
<div class="inner">
<div class="story-head">
<div class="location">
<h5>Location Name</h5>
<p>Some area</p>
</div>
<div class="dated">
<span class="opened">Date</span>
<span class="date">
<span>July</span>
<span>
19 <br />
95
</span>
</span>
</div>
</div>
<div class="story-img">
<img src="https://picsum.photos/200/300?random=1" alt="Featured" class="lazyload visi" />
</div>
<div class="excerpt">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime nihil tempora fugiat rem impedit vero. Ipsum, blanditiis molestiae voluptatibus est, porro nisi facilis quo eaque ipsa non laboriosam cum iste.
</div>
</div>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
</ul>
</li>
<li class="year" id="2020">
<h3>2020</h3>
<ul class="stories has-lodge">
<li class="story lodge">
<div class="inner">
<div class="story-head">
<div class="location">
<h5>Location Name</h5>
<p>Some area</p>
</div>
<div class="dated">
<span class="opened">Date</span>
<span class="date">
<span>July</span>
<span>
19 <br />
95
</span>
</span>
</div>
</div>
<div class="story-img">
<img src="https://picsum.photos/200/300?random=1" alt="Featured" class="lazyload visi" />
</div>
<div class="excerpt">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime nihil tempora fugiat rem impedit vero. Ipsum, blanditiis molestiae voluptatibus est, porro nisi facilis quo eaque ipsa non laboriosam cum iste.
</div>
</div>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
</ul>
</li>
<li class="year" id="2022">
<h3>2022</h3>
<ul class="stories has-lodge">
<li class="story lodge">
<div class="inner">
<div class="story-head">
<div class="location">
<h5>Location Name</h5>
<p>Some area</p>
</div>
<div class="dated">
<span class="opened">Date</span>
<span class="date">
<span>July</span>
<span>
19 <br />
95
</span>
</span>
</div>
</div>
<div class="story-img">
<img src="https://picsum.photos/200/300?random=1" alt="Featured" class="lazyload visi" />
</div>
<div class="excerpt">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime nihil tempora fugiat rem impedit vero. Ipsum, blanditiis molestiae voluptatibus est, porro nisi facilis quo eaque ipsa non laboriosam cum iste.
</div>
</div>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
</ul>
</li>
<li class="year" id="2023">
<h3>2023</h3>
<ul class="stories">
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
<li class="story">
<a href="#" class="story-link">
<span class="story-date">
18 Jul 1995
</span>
<div class="story-img image-ratio" style="padding-bottom: 40%">
<img src="https://picsum.photos/200/300?random=1" alt="" class="lazyload visi" />
</div>
<div class="story-auth">
<span>Joe</span>
<span>Some Lodge</span>
</div>
<div class="story-excerpt">
Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do labore et dolore
magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco.
</div>
</a>
</li>
</ul>
</li>
</ul>
<div class="story-tail">
<h2>Pioneering spirit, enduring purpose</h2>
<p>
As we look to the next 30 years of our conservation
journey, Lorem ipsum donor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua.
</p>
</div>
</section>
</div>
<div class="proxy"></div>
</div>
</div>
*,
::after,
::before {
box-sizing: border-box;
}
html,
body {
height: 100%;
max-height: 100vh;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}
body {
font-size: 16px;
line-height: 1.2;
background-color: #4d4945;
color: #f6f4f0;
overflow-x: hidden;
}
a {
text-decoration: none;
transition: color 0.3s;
color: #ede9e1;
}
.container {
background-image: url("../images/dark-background.jpg");
background-repeat: repeat;
background-size: cover;
background-position: center;
background-color: #4d4945;
overscroll-behavior: none;
height: 100%;
max-width: fit-content;
display: flex;
flex-wrap: nowrap;
overflow-y: hidden;
}
.overlay {
display: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 3;
&.show {
display: block;
}
&.dark {
background-image: url("../images/dark-bg.svg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
}
&.preview {
background-color: rgba(77, 73, 69, 0.49);
}
}
.eyebrow {
opacity: 0;
}
.content {
position: relative;
padding: 2rem;
}
.content-fade-in {
opacity: 0;
}
.panel {
position: relative;
display: flex;
align-items: center;
color: #ede9e1;
padding: 110px 0 0;
font-weight: 300;
min-width: fit-content;
height: 100vh;
background-color: #4d4945;
&.intro {
background-size: cover;
background-position: center;
background-repeat: no-repeat;
min-width: 100vw;
max-width: 100vw;
flex-direction: column;
h1 {
color: #ede9e1;
font-size: clamp(30px, 5vw, 90px);
margin: 0 0 1rem;
line-height: 1;
}
p {
font-size: 16px;
}
.button {
margin: 1rem 0 0;
}
.button-round {
position: relative;
bottom: 1rem;
}
}
&.story-board {
padding: 110px 200px 0 0;
.button-round {
pointer-events: visible;
right: 50%;
bottom: 50%;
}
}
}
.years {
list-style: none;
display: flex;
align-items: center;
width: 100%;
margin: 0;
padding: 0;
padding: 0 220px 0 0;
border-left: 1px solid #d69677;
border-right: 1px solid #d69677;
}
.year {
position: relative;
display: flex;
align-items: center;
padding: 0 110px;
&.selected {
h3 {
height: 125px;
}
}
h3 {
position: relative;
margin: 0;
color: #f6f4f0;
font-size: clamp(18px, 1.5vw, 26px);
display: flex;
justify-content: center;
align-items: center;
width: 95px;
height: 0;
overflow: hidden;
border-top: 3px solid #ede9e1;
border-bottom: 3px solid #ede9e1;
transition: height 0.5s;
&::before,
&::after {
content: "";
display: block;
position: absolute;
width: 2px;
height: 200%;
background-color: #3c3a37;
left: calc(50% - 1px);
z-index: -1;
}
&::before {
top: calc(-200% - 2rem);
}
&::after {
bottom: calc(-200% - 2rem);
}
}
&::before {
content: "";
display: block;
position: absolute;
z-index: -1;
bottom: calc(50% + 1px);
transform: translateY(50%);
width: 110px;
left: 0;
height: 2px;
background-image: linear-gradient(
to right,
#ede9e1 40%,
rgba(255, 255, 255, 0) 0%
);
background-position: top;
background-size: 10px 2px;
background-repeat: repeat-x;
}
&:last-child {
.story {
&::after {
width: calc(100% + 320px);
}
}
}
}
.stories {
list-style: none;
margin: 0;
padding: 0;
position: relative;
display: flex;
align-items: center;
&::before {
content: "";
display: block;
position: absolute;
z-index: -1;
bottom: 50%;
transform: translateY(50%);
width: 100px;
left: 0;
height: 2px;
background-image: linear-gradient(
to right,
#ede9e1 40%,
rgba(255, 255, 255, 0) 0%
);
background-position: top;
background-size: 10px 2px;
background-repeat: repeat-x;
}
}
.story {
position: relative;
margin-left: 120px;
min-width: 50px;
max-width: 350px;
opacity: 0;
transition: opacity 0.5s;
&.selected {
opacity: 1;
.story-link {
transform: scaleY(1);
}
&::before {
transform: translateY(-50%) scale(1);
}
}
&.lodge {
min-width: 350px;
transition: opacity 1s;
.inner {
background-color: #3c3a37;
&::before {
content: "";
display: block;
position: absolute;
z-index: -1;
background-color: #3c3a37;
height: 100%;
width: 100%;
top: 100%;
left: 0;
}
.story-head {
position: relative;
padding: 1rem;
display: flex;
justify-content: space-between;
p {
margin: 0;
}
}
.location {
max-width: 70%;
}
.opened {
position: absolute;
right: 50%;
bottom: 30%;
display: inline-block;
transform: rotate(-90deg);
font-size: clamp(18px, 1.5vw, 22px);
font-style: italic;
text-transform: uppercase;
}
.dated {
position: relative;
height: 100%;
margin-top: auto;
}
.date {
display: block;
span {
display: block;
line-height: 1;
&:first-child {
font-size: clamp(17px, 1.5vw, 23px);
}
&:last-child {
font-size: clamp(20px, 2vw, 30px);
}
}
}
h5 {
font-size: clamp(18px, 2vw, 30px);
margin: 0 0 0.5rem;
max-width: 8ch;
}
.location {
display: block;
font-size: 17px;
color: #d69677;
}
.story-img {
padding: 0 !important;
img {
max-width: 50%;
margin: 0 auto;
}
}
.excerpt {
padding: 1rem;
}
}
}
&::after {
content: "";
display: block;
position: absolute;
z-index: -1;
bottom: 50%;
width: calc(100% + 100px);
left: 9px;
height: 2px;
background-image: linear-gradient(
to right,
#ede9e1 40%,
rgba(255, 255, 255, 0) 0%
);
background-position: top;
background-size: 10px 2px;
background-repeat: repeat-x;
}
&::before {
content: "";
display: block;
position: absolute;
left: -10px;
top: 50%;
width: 18px;
height: 18px;
background-color: #f6f4f0;
transform: translateY(-50%) scale(0);
transform-origin: center;
will-change: transform;
transition: transform 0.5s, background 0.5s;
}
&:hover {
&::before {
transform: translateY(-50%) scale(1.3);
background-color: #d69677;
}
}
}
.story-link {
display: flex;
flex-direction: column;
width: 250px;
font-size: 14px;
margin: 0 0px 33px -11px;
transform: scaleY(0);
will-change: transform;
transition: transform 1s;
&::before {
content: "";
display: block;
position: absolute;
left: 10px;
top: 47px;
width: 1px;
height: calc(100% - 16px);
background-color: #ede9e1;
}
&:hover {
.story-img {
img,
video {
transform: scale(1.1);
}
}
}
}
.story-date {
order: 1;
color: #d69677;
font-size: 18px;
padding: 0.25rem 0;
max-height: 32px;
max-width: fit-content;
border-top: 1px solid #d69677;
border-bottom: 1px solid #d69677;
}
.story-img {
order: 2;
margin: 15px 0 0 30px;
img,
video {
pointer-events: none;
max-width: 120px;
transition: transform 0.5s;
}
}
.story-auth {
order: 3;
padding: 0 0 0 30px;
span {
color: #f6f4f0;
display: block;
line-height: 1.2;
&:last-child {
color: #d69677;
}
}
}
.story-excerpt {
order: 4;
padding: 10px 0 0 30px;
}
.box {
width: 100px;
height: 80px;
text-align: center;
line-height: 80px;
background-color: white;
border-radius: 8px;
color: #222;
font-weight: 700;
margin-left: 20px;
will-change: transform;
}
.box.active {
background-color: orange;
border: 2px solid white;
}
.story-tail {
padding: 0 0 0 60px;
min-width: 32vw;
h2 {
font-size: clamp(38px, 4vw, 68px);
max-width: 15ch;
}
p {
font-size: clamp(18px, 1.5vw, 25px);
max-width: 35ch;
}
}
.timeline {
position: relative;
z-index: 5;
overflow: hidden;
width: 100%;
&::after {
content: "";
position: absolute;
bottom: 50%;
transform: translateY(50%);
left: 0;
width: 100%;
height: 0.25rem;
background: #3c3a37;
pointer-events: none;
z-index: -1;
}
}
.timeline-list {
list-style: none;
display: flex;
justify-content: space-between;
align-items: center;
margin: 0;
padding: 0;
height: 100%;
}
.timeline-marker {
position: fixed;
bottom: 20px;
left: 300px;
width: 10px;
height: 10px;
transform: translate3d(-50%, -50%, 0);
background: #d69677;
border-radius: 100%;
z-index: 3;
&::before {
content: "";
position: absolute;
top: calc(50% - 0.2rem);
right: 100%;
width: 100px;
height: 5px;
background-color: #d69677;
z-index: -1;
}
}
.line {
width: 100%;
max-width: 800px;
height: 8px;
margin: 0 0 10px 0;
position: relative;
display: inline-block;
background-color: rgba(255, 255, 255, 1);
}
@media screen and (min-width: 640px) {
.panel {
padding: 100px 0;
&.intro {
justify-content: center;
flex-direction: row;
h1 {
max-width: 12ch;
}
p {
max-width: 75ch;
}
}
&.story-board {
padding: 100px 100px 0 0;
}
}
.story {
&.lodge {
.inner {
.story-head {
p {
max-width: 10ch;
}
}
.story-img {
img {
max-width: 100%;
margin: 0 0 0 auto;
}
}
}
}
&:not(.lodge) {
.story-img {
margin: 8px 0 8px 30px;
}
}
}
.container {
overflow-y: unset;
}
.stories {
.story {
&:nth-child(even) {
.story-link {
bottom: 50px;
top: unset;
transform-origin: bottom;
&::before {
top: 40px;
bottom: unset;
}
}
.story-date {
order: 1;
}
.story-img {
order: 2;
}
.story-auth {
order: 3;
}
.story-excerpt {
order: 4;
}
}
&:nth-child(odd) {
.story-link {
top: 50px;
bottom: unset;
transform-origin: top;
&::before {
top: -24px;
bottom: unset;
}
}
.story-excerpt {
order: 1;
padding: 0 0 0 30px;
}
.story-auth {
order: 2;
padding: 10px 0 0 30px;
}
.story-img {
order: 3;
}
.story-date {
order: 4;
}
}
// &:nth-child(4n) {
// .story-link {
// bottom: 130px;
// &::before {
// height: calc(100% + 55px);
// }
// }
// }
&:nth-child(4n + 1) {
.story-link {
top: 120px;
&::before {
height: calc(100% + 55px);
top: -95px;
}
}
}
}
&:not(.has-lodge) {
.story {
.story-img {
margin: 8px 0 8px 30px;
}
&:nth-child(odd) {
.story-link {
bottom: 50px;
top: unset;
transform-origin: bottom;
&::before {
top: 47px;
height: calc(100% - 25px);
}
}
.story-excerpt {
order: 4;
padding: 0 0 0 30px;
}
.story-auth {
order: 3;
padding: 10px 0 0 30px;
}
.story-img {
order: 2;
}
.story-date {
order: 1;
}
}
&:nth-child(even) {
.story-link {
top: 50px;
bottom: unset;
transform-origin: top;
&::before {
top: -24px;
bottom: unset;
}
}
.story-excerpt {
order: 1;
padding: 0 0 0 30px;
}
.story-auth {
order: 2;
padding: 10px 0 0 30px;
}
.story-img {
order: 3;
}
.story-date {
order: 4;
}
}
}
}
}
.story-link {
position: absolute;
left: -10px;
z-index: 100;
margin: 0;
}
}
@media screen and (min-width: 1024px) {
.content {
padding: 0 100px 0 0;
}
.story {
&.lodge {
.inner {
.story-head {
padding: 4rem 1rem 2rem;
}
}
}
}
}
@media screen and (min-width: 1280px) {
.panel {
&.intro {
.button-round {
position: absolute;
right: 10%;
bottom: 50%;
transform: translateY(50%);
transition: right 0.3s;
&:hover {
right: calc(10% - 20px);
}
}
}
}
}
// gsap.to()... infinity and beyond!
// For more check out greensock.com
document.addEventListener("DOMContentLoaded", () => {
function storyTimeline() {
gsap.registerPlugin(
ScrollTrigger,
Draggable,
ScrollSmoother,
ScrollToPlugin
);
const introPanel = document.querySelector(".panel.intro");
if (introPanel) {
gsap.to(".content-fade-in", {
duration: 1,
opacity: 1,
stagger: 1
});
}
const panelsContainer = document.querySelector(".container");
if (panelsContainer) {
const sections = gsap.utils.toArray(".panel");
let maxWidth = 0;
const getMaxWidth = () => {
maxWidth = 0;
sections.forEach((section) => {
maxWidth += section.offsetWidth;
});
};
getMaxWidth();
ScrollTrigger.addEventListener("refreshInit", getMaxWidth);
let scrollTween = gsap.to(sections, {
x: () => `-${maxWidth - window.innerWidth}`,
ease: "none"
});
let horizontalScroll = ScrollTrigger.create({
animation: scrollTween,
trigger: panelsContainer,
pin: true,
scrub: true,
end: () => `+=${maxWidth}`,
invalidateOnRefresh: true
});
//sections.forEach((sct, i) => {
// ScrollTrigger.create({
// trigger: sct,
// start: () => 'top top-=' + (sct.offsetLeft - window.innerWidth/2) * (maxWidth / (maxWidth - window.innerWidth)),
// end: () => '+=' + sct.offsetWidth * (maxWidth / (maxWidth - window.innerWidth)),
// toggleClass: {targets: sct, className: "active"}
// });
//});
// dragRatio changed to the part in the horizontal sroll that's there to calculate the offset between the duration of the scroll and the amount of x-translation of the content (that needs to be included there when triggering things when certain sections reach a certain point in the viewport - as seen in commented out part above)
var dragRatio = maxWidth / (maxWidth - window.innerWidth);
var drag = Draggable.create(".proxy", {
trigger: panelsContainer,
type: "x",
allowContextMenu: true,
onPress() {
this.startScroll = horizontalScroll.scroll();
},
onDrag() {
horizontalScroll.scroll(
this.startScroll - (this.x - this.startX) * dragRatio
);
}
})[0];
let storyLinks = document.querySelectorAll(".story");
let years = document.querySelectorAll(".year");
years.forEach((year) => {
ScrollTrigger.create({
trigger: year,
containerAnimation: scrollTween,
onEnter: () => year.classList.add("selected"),
start: "left 90%",
ease: "none"
});
});
storyLinks.forEach((storyLink) => {
ScrollTrigger.create({
trigger: storyLink,
containerAnimation: scrollTween,
onEnter: () => storyLink.classList.add("selected"),
start: "left 80%",
ease: "none"
});
});
gsap.to(".navbar .button", {
opacity: 1,
pointerEvents: "visible",
duration: 1,
ease: "none",
scrollTrigger: {
trigger: ".panel.story-board",
containerAnimation: scrollTween,
start: "left center",
toggleActions: "play none none reset"
}
});
/* Main navigation */
document.querySelectorAll(".button-round").forEach((anchor) => {
anchor.addEventListener("click", function (e) {
e.preventDefault();
let targetElem = document.querySelector(
e.target.getAttribute("href")
),
y = targetElem;
if (
targetElem &&
panelsContainer.isSameNode(targetElem.parentElement)
) {
let totalScroll =
scrollTween.scrollTrigger.end - scrollTween.scrollTrigger.start,
totalMovement = (sections.length - 1) * targetElem.offsetWidth;
y = Math.round(
scrollTween.scrollTrigger.start +
(targetElem.offsetLeft / totalMovement) * totalScroll
);
}
gsap.to(window, {
scrollTo: {
y: y,
autoKill: false
},
duration: 1
});
});
});
}
}
storyTimeline();
});
Also see: Tab Triggers