Last active
July 7, 2024 22:17
-
-
Save maietta/a1acb4095927e75853d754904d2d39e5 to your computer and use it in GitHub Desktop.
Fancy Hero Horizontal Accordion, no JS and no anchor tags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
let sections = [ | |
{ | |
title: 'WEBSITES', | |
content: 'Content for section 1', | |
color: 'bg-[#85aa74]' | |
}, | |
{ | |
title: 'WEB HOSTING', | |
color: 'bg-[#fee6a6]', | |
content: 'Content for section 2' | |
}, | |
{ | |
title: 'TELEPHONE', | |
color: 'bg-[#81bac5]', | |
content: 'Content for section 3' | |
}, | |
{ | |
title: 'SOFTWARE', | |
color: 'bg-[#eb6c29]', | |
content: 'Content for section 4' | |
} | |
]; | |
</script> | |
<div class="relative flex h-[80vh] items-center px-10 mt-4"> | |
<div class="absolute left-10 w-1/2 text-black dark:text-white"> | |
<div class="w-[650px]"> | |
<div class="space-y-6"> | |
<h1 class="font-mono text-4xl">Premium Web & Internet Solutions</h1> | |
<p class="font-mono text-xl opacity-80"> | |
We've got the basics stuff for any small business or indie developer. | |
</p> | |
</div> | |
<div class="mt-10 flex w-3/4 items-center justify-start space-x-10 font-light"> | |
<button class="rounded-xl bg-[#fee6a6] px-10 py-4 text-2xl text-[#092f42] hover:opacity-90" | |
>Get Stared</button | |
> | |
<a class="cursor-pointer text-2xl hover:underline" href="/"> Find out more </a> | |
</div> | |
</div> | |
</div> | |
<div | |
class="group/accord absolute left-[98%] flex h-[80vh] w-1/2 -translate-x-full gap-2 overflow-hidden hover:w-[96.5vw]" | |
> | |
{#each sections as section, index} | |
<!-- Section 1 --> | |
<div | |
class="group/section relative flex h-full w-1/4 items-end rounded-lg border border-white {section.color} bg-cover bg-center text-[#092f42] transition-[width] duration-300 ease-in-out hover:!w-[100%] group-hover/accord:w-[13.33%]" | |
> | |
<button | |
class="absolute inset-0 flex h-full w-full cursor-pointer flex-col items-start justify-start gap-4 bg-cover bg-center text-[#092f42] group-hover/section:hidden" | |
> | |
<span | |
class="absolute bottom-[5rem] left-1/2 block origin-left -rotate-90 whitespace-nowrap text-3xl uppercase transition-all duration-300" | |
>{section.title}</span | |
> | |
<div class="absolute bottom-8 left-1/2 -translate-x-1/2"> | |
<span class="text-3xl font-black text-[#092f42]">X</span> | |
</div> | |
</button> | |
<div | |
class="absolute inset-0 z-10 box-border hidden items-center justify-center bg-cover bg-center group-hover/section:flex" | |
> | |
{section.content} | |
</div> | |
</div> | |
{/each} | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
here is a full responsive version: