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.
<main id="main" hx-history-elt>
<article class=" bg-white relative flex lg:h-dvh flex-col lg:flex-row lg:items-start lg:gap-3 lg:[&>div]:shrink-0 overflow-x-hidden">
<div class="project-header [&_.overlap]:!text-body [&_.overlap]:relative [&>header]:h-full [&.project-header.project-header--show]:block shadow-header bg-white h-[56px] sticky top-0 z-[100] w-full left-4 md:left-8 xl:left-12 lg:hidden">
<header class="z-30 relative">
<div class="overlap
[&.hero-overlap]:text-white
[&>.overlap.overlap-active_a]:text-body/50
[&>.overlap.overlap-active_.active_a]:!text-black
[&>.overlap.overlap-active]:text-black
transition-all duration-500 z-20 flex justify-between items-start md:items-center px-2 py-2 md:py-0 md:px-4 w-full fixed lg:top-0
max-[2200px]:hover:[&.overlap-active]:shadow-header
max-[2200px]:hover:[&.overlap-active]:bg-white/100
top-shadow max-lg:[&.overlap-active.top-shadow--show]:shadow-header max-lg:[&.overlap-active.top-shadow--show]:bg-white
max-md:[&.overlap-active]:bg-white/100" x-data="{ open: false }" :class="open ? 'md:[&_.overlap-active]:bg-white/100 bg-white/100 !text-black [&_.active_a]:!text-black md:[&_.active_a]:!text-white md:!text-white md:bg-white/0 md:shadow-none md:[&.overlap-active]:shadow-header md:[&.overlap-active]:!text-black md:[&.overlap-active]:bg-white [&_li]:opacity-100 z-40 [&_li]:pb-9 md:[&_li]:pb-0 [&_li]:overflow-visible md:[&_ul]:gap-0 md:[&_ul]:space-x-8 [&_li]:w-full' : ''">
<div class="overlap [&.overlap]:text-white [&>.overlap.overlap-active_a]:text-body/50 [&>.overlap.overlap-active_.active_a]:!text-black [&>.overlap.overlap-active]:text-black overlap group flex flex-row-reverse items-start md:items-center">
<div class="peer ml-3 mt-2 md:mt-0 md:ml-4 relative flex">
<div class="relative z-20">
<div class="md:py-8 md:pr-64 group grid place-content-center ">
<nav class="z-20 relative">
<ul class="flex flex-col space-y-0 md:gap-0 md:flex-row md:space-x-0 md:group-hover:space-x-8 transition-all duration-300 [&_.active]:opacity-100">
<li class=" text-body-300 md:text-white/50 md:text-white/50 whitespace-nowrap transition-all duration-300 md:group-hover:opacity-100 opacity-0 h-0 overflow-visible md:h-auto md:w-0 md:group-hover:w-full">
<a href="https://dma.leightonhughes.co/studio">Studio</a>
</li>
<li class=" text-body-300 md:text-white/50 md:text-white/50 whitespace-nowrap transition-all duration-300 md:group-hover:opacity-100 opacity-0 h-0 overflow-visible md:h-auto md:w-0 md:group-hover:w-full">
<a href="https://dma.leightonhughes.co/projects">Projects</a>
</li>
<li class=" text-body-300 md:text-white/50 md:text-white/50 whitespace-nowrap transition-all duration-300 md:group-hover:opacity-100 opacity-0 h-0 overflow-visible md:h-auto md:w-0 md:group-hover:w-full">
<a href="https://dma.leightonhughes.co/contact">Contact</a>
</li>
<li class=" text-body-300 md:text-white/50 md:text-white/50 whitespace-nowrap transition-all duration-300 md:group-hover:opacity-100 opacity-0 h-0 overflow-visible md:h-auto md:w-0 md:group-hover:w-full">
<a href="/chinese">公司简介</a>
</li>
</ul>
</nav>
<h1 x-data="{ isOpen: true }" class="up-arrow [&.up-arrow]:hidden max-md:[&.up-arrow.up-arrow--show]:block z-40 mt-0 leading-normal md:absolute md:bottom-1/2 md:translate-y-1/2 md:group-hover:hidden whitespace-nowrap text-base normal-case font-normal tracking-normal md:hidden" :class="open ? 'opacity-0 hidden max-md:[&.up-arrow.up-arrow--show]:hidden' : 'opacity-100'">
Title
</h1>
</div>
</div>
</div>
<div class="hidden md:block" x-data="{ open: false }" @click.away="open = false">
<button @click="open = ! open" class="cursor-pointer flex items-center h-10 w-10 md:w-14 md:h-14 justify-center">
<div class="w-5 flex items-center justify-center relative">
<span x-bind:class="open ? 'translate-y-0 rotate-45 md:-translate-y-[6px] md:rotate-0' : '-translate-y-[6px]'" class="group-hover:rotate-45 group-hover:translate-y-0 transform w-full h-[1.5px] bg-current absolute"></span>
<span x-bind:class="open ? 'opacity-0 -translate-x-3 md:opacity-100 md:translate-x-0' : 'opacity-100'" class="group-hover:opacity-0 group-hover:-translate-x-3 transform w-full h-[1.5px] bg-current absolute"></span>
<span x-bind:class="open ? 'translate-y-0 -rotate-45 md:translate-y-[6px] md:rotate-0' : 'translate-y-[6px]'" class="group-hover:translate-y-0 group-hover:-rotate-45 transform w-full h-[1.5px] bg-current absolute"></span>
</div>
</button>
</div>
<div class="md:hidden">
<button @click="open = ! open" class="cursor-pointer flex items-center h-10 w-10 md:w-14 md:h-14 justify-center">
<div class="w-5 flex items-center justify-center relative">
<span x-bind:class="open ? 'translate-y-0 rotate-45 md:-translate-y-[6px] md:rotate-0 text-black' : '-translate-y-[6px]'" class="transform w-full h-[1.5px] bg-current absolute"></span>
<span x-bind:class="open ? 'opacity-0 -translate-x-3 md:opacity-100 md:translate-x-0 text-black' : 'opacity-100'" class="transform w-full h-[1.5px] bg-current absolute"></span>
<span x-bind:class="open ? 'translate-y-0 -rotate-45 md:translate-y-[6px] md:rotate-0 text-black' : 'translate-y-[6px]'" class="transform w-full h-[1.5px] bg-current absolute"></span>
</div>
</button>
</div>
</div>
<div class="h-8 w-8 md:h-10 md:w-10 p-1">
</div>
<div class="up-arrow [&.up-arrow]:hidden z-40 relative" x-bind:class="open ? '' : 'max-md:[&.up-arrow.up-arrow--show]:block max-md:[&.up-arrow.up-arrow--show]:bg-white'">
<div class="p-2">
<a href="#page-top" class="smooth-scroll">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.25 5.87128V22.0607H12.75V5.87139L16.4696 9.591L17.5303 8.53034L11.9999 3.00001L6.46961 8.53034L7.53027 9.591L11.25 5.87128Z" fill="#111111" />
</svg>
</a>
</div>
</div>
<div class="fixed top-0 right-0 z-30 transition-opacity duration-150" x-bind:class="open ? 'z-40 max-md:opacity-100 ' : ''">
<div class="text-body">
<a href="https://dma.leightonhughes.co/" class="group relative m-4 block">
<div class="hidden lg:block">
<div class="absolute left-1/2 top-1/2 z-20 flex h-4/5 w-4/5 -translate-x-1/2 -translate-y-1/2 items-center justify-center bg-black text-xs font-bold text-white opacity-0 transition-all duration-300 group-hover:h-full group-hover:w-full group-hover:opacity-100">
Home
</div>
</div>
<div class="md:p-2">
<div class="h-8 w-8 md:h-10 md:w-10">
<svg viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.91375 0C7.64931 0 9.1706 0.578519 10.1777 1.62843C11.7418 3.23542 11.9561 5.48522 11.9561 7.58503C11.9561 9.68484 11.7418 11.9561 10.1777 13.5631C9.1706 14.613 7.64931 15.1915 5.91375 15.1915H0V0H5.91375ZM8.05641 11.8489C9.12775 10.7776 9.14917 8.97776 9.14917 7.58503C9.14917 6.1923 9.12775 4.41389 8.05641 3.34256C7.54217 2.82832 6.79224 2.48549 5.91375 2.48549H2.76404V12.706H5.91375C6.79224 12.706 7.54217 12.3632 8.05641 11.8489ZM39.9964 0V15.1915H37.3181V4.34961L33.3756 14.9772H31.34L27.4189 4.22105V15.1915H24.7406V0H28.4689L32.4542 10.8205L36.461 0H39.9964ZM39.2073 39.9964L33.8721 24.805H30.8509L25.5157 39.9964H28.3011L29.2868 37.0824H35.3291L36.3147 39.9964H39.2073ZM34.472 34.5969H30.1438L32.3079 28.1904L34.472 34.5969ZM0 37.4967H11.9561V40H0V37.4967Z" class="fill-current" />
</svg>
</div>
</div>
</a>
</div>
</div>
</div>
</header>
</div>
<div class="outer lg:h-screen lg:overflow-x-hidden">
<div class="scroller flex flex-col will-change-transform lg:flex-row">
<div class="vertical-scroll lg:pb-32">
<div class="pt-12 md:pt-32 lg:mx-12 lg:w-[480px] xl:w-[527px] 2xl:w-[640px] xl:mx-24">
<div class="mx-5 md:mx-8 lg:mx-0">
<h1 class="upper">
Title
</h1>
<p class="mb-0 mt-3 text-body-500">
Subtitle
</p>
</div>
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-house-thumb.png?auto=compress%2Cformat&fit=clip&q=80&w=750&s=be9dbacd1e17f12e49689c5c8bb2fdc3 750w, https://dma-staging.imgix.net/projects/lin-house/lin-house-thumb.png?auto=compress%2Cformat&fit=clip&q=80&w=1184&s=0cfc6b7b102824590f7218d9fdc9dd23 1184w" class="!leading-[0] mt-8 md:mt-[60px] lg:hidden" />
<div class="mx-5 my-12 md:mx-8 md:my-16 lg:mx-0 lg:mt-10 lg:mb-0">
<div x-data="{ expanded: false }">
<div :class="{ 'h-auto': expanded, 'h-[220px]': !expanded }" class="lg:h-auto relative overflow-y-hidden transition-all ease-in lg:overflow-auto first:[&>*]:mt-0">
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
<div :class="{ 'hidden': expanded, 'block': !expanded }" class="lg:hidden w-full h-28 bg-gradient-to-t from-white to-white/0 absolute bottom-0 left-0"></div>
</div>
<button :class="{ 'hidden': expanded, 'block': !expanded }" @click="expanded = !expanded" class="mt-4 lg:hidden">Read More</button>
</div>
</div>
</div>
</div>
<div class="horizontal-scroll flex will-change-transform lg:sticky lg:top-0 lg:h-dvh">
<div class="panel flex flex-col gap-2 bg-white will-change-transform md:gap-3 lg:flex-row">
<div class="flex shrink-0 flex-col gap-2 will-change-transform md:gap-3 lg:h-screen lg:flex-row lg:items-center [&>div]:shrink-0">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-house-thumb.png?auto=compress%2Cformat&fit=clip&q=80&w=750&s=be9dbacd1e17f12e49689c5c8bb2fdc3 750w, https://dma-staging.imgix.net/projects/lin-house/lin-house-thumb.png?auto=compress%2Cformat&fit=clip&q=80&w=1184&s=0cfc6b7b102824590f7218d9fdc9dd23 1184w" class="hidden origin-top !leading-[0] will-change-transform lg:block lg:h-screen" />
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-02.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=2db740ccafd280b4759f0c4bbaf929d3 592w, https://dma-staging.imgix.net/projects/lin-house/lin-02.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=92aa04a244de3c504dfa5659b86808e8 1184w" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="lg:pt-30 relative object-scale-down px-8 py-14 md:px-20 md:py-28 lg:h-screen lg:p-22 lg:pb-40 xl:pb-36 2xl:px-28 2xl:pb-40 2xl:pt-[120px]">
<div class="relative h-[100%]">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-03.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=6ba26b322db92e7e5452e7bf99e528f0 592w, https://dma-staging.imgix.net/projects/lin-house/lin-03.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=761717cb91028102e945b6af25321666 1184w" class="h-[100%] w-auto" />
<figcaption class="relative left-0 right-0 mt-6 text-sm lg:absolute">
The concept driving the house was a fusion of kiwi laid back living and asian inspired detailing and materiality.
</figcaption>
</div>
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-04.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=e161ea2de9a3a7e0cd2663d3934f313f 592w, https://dma-staging.imgix.net/projects/lin-house/lin-04.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=d6a98e969b664eac75b0b32fd5e8b9f9 1184w" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-05.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=906f040d665d92f0842afba621bac066 592w, https://dma-staging.imgix.net/projects/lin-house/lin-05.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=855b73972af4fcd41cc67f702933b0f6 1184w" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="lg:pt-30 relative object-scale-down px-8 py-14 md:px-20 md:py-28 lg:h-screen lg:p-22 lg:pb-40 xl:pb-36 2xl:px-28 2xl:pb-40 2xl:pt-[120px]">
<div class="relative h-[100%]">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-06.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=ad1312403e832c0e3407034926a1cb9f 592w, https://dma-staging.imgix.net/projects/lin-house/lin-06.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=9e105243573684fca6a4555f5d3dedab 1184w" class="h-[100%] w-auto" />
<figcaption class="relative left-0 right-0 mt-6 text-sm lg:absolute">
The cast insitu concrete wall in the entry was formed using bamboo formwork creating a beautiful textural and soft quality to the concrete.
</figcaption>
</div>
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-07.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=fcfcce46eb9fa48afbee001019ac258e 592w, https://dma-staging.imgix.net/projects/lin-house/lin-07.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=9f36c54b58ec4f0ada759f25ca6b370d 1184w" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-08.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=8188805a7ceda4c653313fd6a4e95ec2 592w, https://dma-staging.imgix.net/projects/lin-house/lin-08.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=a845fb8ea1da4b3e79e8646e6b0d1fca 1184w" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="lg:pt-30 relative object-scale-down px-8 py-14 md:px-20 md:py-28 lg:h-screen lg:p-22 lg:pb-40 xl:pb-36 2xl:px-28 2xl:pb-40 2xl:pt-[120px]">
<div class="relative h-[100%]">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-09.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=ea38a12a4008d279527bfa2ce4fbd836 592w, https://dma-staging.imgix.net/projects/lin-house/lin-09.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=e147d7559dcc86ea7a931e730187ba20 1184w" class="h-[100%] w-auto" />
<figcaption class="relative left-0 right-0 mt-6 text-sm lg:absolute">
The kitchen was designed for asian cooking, with a full chef's cooking scullery elegantly hidden behind the more traditionally styled kiwi galley kitchen. All the timber cabinetry was a textured oak veneer with a natural oil finish.
</figcaption>
</div>
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-10.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=ef12288045c68ec32df2b1a0d2e4958e 592w, https://dma-staging.imgix.net/projects/lin-house/lin-10.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=c3e8bfd97158d859a9acf84bd843bdae 1184w" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-12.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=63b9d66dd5c7959490b30dff4fa3cc18 592w, https://dma-staging.imgix.net/projects/lin-house/lin-12.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=d971b9c1fbba8217b502244124bc76ea 1184w" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
<div class="block-blockquote">
<div class="flex items-center bg-white will-change-transform lg:aspect-[6/8] lg:h-screen">
<figure class="px-8 py-20 md:px-24 md:py-36">
<blockquote>
<p class="font-light leading-tight">
The kitchen was designed for asian cooking, with a full chef's cooking scullery elegantly hidden behind the more traditionally styled kiwi galley kitchen. All the timber cabinetry was a textured oak veneer with a natural oil finish.
</p>
</blockquote>
<figcaption class="mt-4 text-sm md:mt-6">
</figcaption>
</figure>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-13.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=b27bec1a9a4dc76f678bc1783b23ec8b 592w, https://dma-staging.imgix.net/projects/lin-house/lin-13.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=b389ff8a97cbe039fa95ded8035b6581 1184w" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-14.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=b2a33751a6c88d084d3fb2c6f30298a2 592w, https://dma-staging.imgix.net/projects/lin-house/lin-14.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=b8dec80e7a69d69e37dd5b0ec2808518 1184w" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-15.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=30f3373ca5a1642a1264730c51294a38 592w, https://dma-staging.imgix.net/projects/lin-house/lin-15.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=0b778631a50288b22a08a11dd68945a7 1184w" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="lg:pt-30 relative object-scale-down px-8 py-14 md:px-20 md:py-28 lg:h-screen lg:p-22 lg:pb-40 xl:pb-36 2xl:px-28 2xl:pb-40 2xl:pt-[120px]">
<div class="relative h-[100%]">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-16.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=563a8b98562f0abfaf3763fba7a15ad1 592w, https://dma-staging.imgix.net/projects/lin-house/lin-16.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=2320f7dd960f57f9ca2d5f0e21525a7f 1184w" class="h-[100%] w-auto" />
<figcaption class="relative left-0 right-0 mt-6 text-sm lg:absolute">
The media room was specifically designed with acoustics and ambiance in mind, with acoustic panelling and a luxurious plum velvet curtain.
</figcaption>
</div>
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-17.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=b7cae944666ae0368a948518c4192994 592w, https://dma-staging.imgix.net/projects/lin-house/lin-17.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=e5ea0b34fe22f82a185d8dbbae97ceca 1184w" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
<div class="block-image">
<div class="w-full">
<div class="content will-change-transform">
<figure class="flex flex-col">
<img srcset="https://dma-staging.imgix.net/projects/lin-house/lin-18.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=592&s=acc4c2e6febc5521b80f71ba59b2174b 592w, https://dma-staging.imgix.net/projects/lin-house/lin-18.png?auto=compress%2Cformat&fillTransforms=1&fit=clip&q=80&w=1184&s=4d47634ad5b09ba880f46b1425926cde 1184w" class="w-auto lg:h-screen" />
</figure>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</article>
</main>
function initializeScrollTrigger() {
gsap.registerPlugin(ScrollTrigger);
let slider = document.querySelector(".scroller");
let vSlider = document.querySelector(".vertical-scroll");
let panel = document.querySelector(".panel");
let sections = gsap.utils.toArray(".panel > div");
let pageTrigger, diff, currentScrollPos;
const tl = gsap.timeline();
let mm = gsap.matchMedia();
mm.add("(min-width: 1024px)", () => {
let verticalTl = gsap.timeline({
defaults: {
ease: "none"
},
scrollTrigger: {
trigger: slider,
start: "top top",
end: "bottom bottom",
scrub: true,
markers: false
}
});
verticalTl.fromTo(
slider,
{
yPercent: 0,
opacity: 1
},
{
yPercent: 0,
opacity: 1
}
);
});
let vSliderWidth = vSlider.offsetWidth;
let totalWidth = sections.reduce(
(acc, section) => acc + section.offsetWidth,
vSliderWidth
);
let viewWidth = window.innerWidth;
let leftMargin = 48;
let scrollWidth = totalWidth - viewWidth + leftMargin;
mm.add("(min-width: 1024px)", () => {
let horizontalTl = gsap.timeline({
defaults: {
ease: "none"
},
scrollTrigger: {
scroller: ".outer",
trigger: slider,
pin: true,
scrub: true,
end: "+=" + scrollWidth + "px",
markers: false,
start: "bottom bottom",
onRefresh: (self) => {
pageTrigger = self;
},
invalidateOnRefresh: true
}
});
horizontalTl.to(slider, {
x: -scrollWidth
});
});
Observer.create({
target: ".panel",
type: "wheel",
onChangeX: (self) => pageTrigger.scroll(pageTrigger.scroll() - self.deltaX)
});
Observer.create({
target: ".panel",
type: "touch",
onPress: (self) => (self.startScroll = pageTrigger.scroll()),
onDrag: (self) =>
pageTrigger.scroll(self.startScroll - (self.x - self.startX))
});
}
function checkForHorizontal() {
if (document.querySelector(".scroller")) {
setTimeout(initializeScrollTrigger, 100);
} else {
setTimeout(checkForHorizontal, 100);
}
}
checkForHorizontal();
Also see: Tab Triggers