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 class="wrapper">
<!-- row one-->
<div class="pinRight right hero text-block white layer-1 pinAllMobile">
<div class="">
<h1>Nerveux intérêt détail secret six. Haut soit devoir.</h1>
<p>Excepturi dolorum natus possimus ullam autem. Ab ex asperiores voluptas odio facilis. Quos architecto voluptatum quo necessitatibus ratione.</p>
</div>
</div>
<div class="left layer-2">
<div class="pinLeft pinAllMobile image-block" style="background: url(https://picsum.photos/600/800?random=1) center / cover;">
</div>
<div class="rightTrigger"></div>
<div class="quote-block">
<div class="inner stack">
<blockquote>ONE Partie lier franc appartement compte coeur. Forcer gloire pièce sien contenir accepter durant. Vision intérieur envoyer nouveau discussion curieux son.</blockquote>
</div>
<div class="overlay"></div>
</div>
</div>
</div>
<!-- row two -->
<div class="panelAnimation pinRight right text-block black layer-3 pinAllMobile">
<div>
<h2>maladie</h2>
<div class="stack">
<h4>Résoudre déclarer recherche considérer course. Complètement gouvernement chemin entendre disposer second. Trembler peur intelligence fidèle espace contraire.'</h4>
<div class="stack">
<p>Maiores eligendi assumenda. Beatae quis odit fuga nesciunt. Consequuntur sequi sequi adipisci.</p>
<p>Natus doloribus asperiores perspiciatis laborum quas aliquam. Fuga nam maxime ut. Nisi accusantium voluptatum quasi sint..</p>
</div>
</div>
</div>
</div>
<div class="left layer-4">
<div class="pinLeft pinAllMobile image-block" style="background: url(https://picsum.photos/600/800?random=2) center / cover;">
</div>
<div class="rightTrigger"></div>
<div class="quote-block">
<div class="inner stack">
<blockquote>TWO Partie lier franc appartement compte coeur. Forcer gloire pièce sien contenir accepter durant. Vision intérieur envoyer nouveau discussion curieux son.</blockquote>
</div>
<div class="overlay"></div>
</div>
</div>
<!-- row four -->
<div class="panelAnimation pinRight right text-block white layer-5 pinAllMobile">
<div>
<h2>transform integrated synergies.</h2>
<h4>Posséder sept d'autres colline attitude aimer. Représenter étude grâce entraîner haut créer. Nourrir ce habitant lui choix entre étoile.</h4>
<div>
<p>Repellendus hic excepturi recusandae necessitatibus assumenda ut. Assumenda autem veritatis laborum corrupti et similique. At saepe esse aut facere ratione..</p>
<p>Deleniti debitis quasi ullam nemo autem. Error dolore est rerum quisquam delectus blanditiis. Non vero magni excepturi tenetur nisi temporibus.</p>
<p>Facilis consequatur accusamus et voluptates. Delectus deleniti nesciunt pariatur provident. Consectetur deleniti ea ducimus ipsum veritatis.</p>
</div>
</p>
</div>
</div>
<div class="left layer-6">
<div class="pinLeft pinAllMobile image-block" style="background: url(https://picsum.photos/600/800?random=3) center / cover;"></div>
<div class="rightTrigger"></div>
<div class="quote-block">
<div class="inner stack">
<blockquote>THREE Spend appear down wait by remain. Agree huge thousand art medical piece security. Size grow art.</blockquote>
</div>
<div class="overlay"></div>
</div>
</div>
<!-- row five -->
<div class="panelAnimation pinRight right text-block black layer-7 pinAllMobile">
<div>
<h2>Scholz KG</h2>
<h4>In excepturi cumque quisquam blanditiis itaque. Fugit corporis nam aspernatur cum maiores ea. Vitae laborum deleniti consectetur officiis assumenda..</h4>
<div>
<p>Velit inventore esse porro non necessitatibus deleniti. Debitis soluta non maxime veniam doloribus. Nobis vel soluta quae cum.</p>
<p>Marche tout endroit imposer aujourd'hui public. Importance grâce cours ennemi soumettre étranger contenter. Venir curieux dur fils fermer sur..</p>
<p>Eveniet nostrum libero animi. At doloribus quos perspiciatis odio veniam suscipit. In incidunt repudiandae ab praesentium minima veniam.</p>
</div>
</div>
</div>
<div class="left layer-8">
<div class="pinLeft pinAllMobile image-block" style="background: url(https://picsum.photos/600/800?random=4) center / cover;">
</div>
<div class="rightTrigger"></div>
<div class="quote-block">
<div class="inner stack">
<blockquote>e-enable leading-edge e-commerce</blockquote>
</div>
<div class="overlay"></div>
</div>
</div>
<!-- row six -->
<div class="panelAnimation pinRight right text-block white layer-9 pinAllMobile">
<div>
<h2>maximize impactful platforms.</h2>
<h4>Sit possimus vero corrupti. Consequuntur cupiditate ad placeat temporibus impedit facilis. Blanditiis laborum harum veniam..</h4>
<div>
<p>Camarade secours palais contraire nu figurer. Cerveau tour matin fusil. Morceau dernier troubler dessiner tuer..</p>
<p>Nihil commodi maiores id ad nesciunt. Quia deserunt excepturi. Quos amet id animi deleniti.</p>
<p>Adipisci explicabo illo in. Molestiae officia totam deserunt. Reiciendis delectus aperiam consectetur quis ut..</p>
</div>
</div>
</div>
<div class="left layer-10">
<div class="pinLeft pinAllMobile image-block" style="background: url(https://picsum.photos/600/800?random=5) center / cover;"></div>
<div class="rightTrigger"></div>
<div class="quote-block">
<div class="inner stack">
<blockquote>Doloremque praesentium error provident assumenda placeat quae recusandae. Veritatis velit quas. Alias placeat sit magnam maiores nostrum.</blockquote>
</div>
<div class="overlay"></div>
</div>
</div>
</div>
html,body{padding:0;margin:0;}
* {
position: relative;
box-sizing: border-box;
}
.wrapper {
--deadzone: 200px;
--leftPanelHeight:calc(100vh + var(--deadzone));
--paddingBottom: 50px;
}
@media only screen and (min-width: 1000px) {
.left {
width: 50%;
height: calc(100vh + 200px);
min-height: 500px;
position: relative;
}
.left .image-block {
height: calc(100vh + 200px));
}
.left .text-block {
height: 100vh;
padding: 0;
}
.left .layer-1 .quote-block {
display: none;
}
.right {
position: absolute;
top: 0;
right: 0;
width: 50%;
}
.rightTrigger {
position: absolute;
top: 50%;
}
}
.left{
position: relative;
height: 100vh;
}
.image-block {
height: 100vh;
background-size: cover;
background-position: center;
padding: 2rem;
}
.quote-block {
z-index:2;
box-sizing: border-box;
padding:1rem 0;
width:100%;
position: absolute;
top: 26vh;
}
.inner{
color: white;
padding: 1rem;
}
.overlay{
position: absolute;
content: "";
width: 100%;
height: 30vh;
bottom: 0;
background: -webkit-linear-gradient(bottom, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 100%);
background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 100%);
mix-blend-mode: multiply;
left: 0;
z-index: -1;
}
.text-block {
height: 100vh;
display: flex;
padding:3rem;
align-items:center
}
.white{
background-color:white
}
.white > *{
color:black
}
.black{
background-color:black
}
.black > *{
color:white
}
.layer-1 {
z-index: 1;
}
.layer-2 {
z-index: 2;
}
.layer-3 {
z-index: 3;
}
.layer-4 {
z-index: 4;
}
.layer-5 {
z-index: 5;
}
.layer-6 {
z-index: 6;
}
.layer-7 {
z-index: 7;
}
.layer-8 {
z-index: 8;
}
.layer-9 {
z-index: 9;
}
.layer-10 {
z-index: 10;
}
.layer-11 {
z-index: 11;
}
gsap.registerPlugin(ScrollTrigger, ScrollToPlugin)
ScrollTrigger.matchMedia({
"(min-width: 1000px)": function () { // desktop
let pinRightPanels = gsap.utils.toArray(".pinRight");
pinRightPanels.forEach((pinRight, i) => { // right panel - text - get all items to fade in
ScrollTrigger.create({
trigger: pinRight,
start: "top top",
pin: true,
end: "max",
pinSpacing:false,
id: "pinRight"+i,
});
});
let imgTrig = gsap.utils.toArray(".rightTrigger");
let panelAnimation = gsap.utils.toArray(".panelAnimation");
panelAnimation.forEach((rightBlock, i) => { // right panel - text - get all items to fade in
const panelTimeline = gsap.timeline({defaults: { ease: "none"}})
panelTimeline
.fromTo(rightBlock,{ autoAlpha:0 },{ duration: 1, autoAlpha: 1}) // fade in panel
ScrollTrigger.create({
trigger: () => imgTrig[i], // trigger from marker of same index
animation: panelTimeline,
start: "top top",
toggleActions: "play none none reverse",
});
});
let pinLeftPanels = gsap.utils.toArray(".pinLeft");
pinLeftPanels.forEach((panel, i) => { // left panel - image
ScrollTrigger.create({
trigger: panel,
start: "top top",
end: "+=200%",
pin: true,
pinSpacing:false,
id: "#"+panel.getAttribute("id"), // used for desktop navigation
});
});
},
"(max-width: 999px)": function () { // mobile
let pinAllMobilePanels = gsap.utils.toArray(".pinAllMobile");
pinAllMobilePanels.forEach((panel, i) => {
ScrollTrigger.create({
trigger: panel,
end: "max",
start: "top top",
pin: true,
pinSpacing: false,
id: "#"+panel.getAttribute("id"), // used for mobile navigation
});
});
},
"all": function () { // all
let quotes = gsap.utils.toArray(".quote-block");
quotes.forEach((quote, i) => {
quotes.text = quote.querySelectorAll(".inner");
quotes.overlay = quote.querySelectorAll(".overlay");
const quotesTl = gsap.timeline({defaults: { ease: "none"}, onComplete: function(){ console.log('quotes - finish') }})
quotesTl
.add('start')
.fromTo(quotes.text ,{ y: '60vh', autoAlpha:0 },{ duration: 0.8, autoAlpha:1, y: 0}, 'start')
.fromTo(quote.overlay, { autoAlpha:0 },{ duration: 1, autoAlpha: 1}, ">-0.2")
ScrollTrigger.create({
animation:quotesTl,
trigger: quote,
start: "bottom bottom",
end: "top top-=50%",
pin: true,
pinSpacing:false,
toggleActions: "play none none reverse",
});
});
}
});
Also see: Tab Triggers