can you make this work correctly
Browse filesFiles changed (3)
- index.html+7-5
- script.js+29-12
- style.css+26-2
11 unmodified lines12131415161718192022 unmodified lines434445464748495051525311 unmodified lines<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script></head><body class="overflow-hidden"><div id="diagonal-scroll-container" class="fixed w-screen h-screen"><div id="content-wrapper" class="absolute origin-top-left"><section class="panel bg-gradient-to-br from-indigo-500 to-purple-600 w-screen h-screen flex items-center justify-center"><div class="text-center max-w-2xl px-4"><h1 class="text-5xl md:text-7xl font-bold text-white mb-6">Scroll Diagonally</h1><p class="text-xl text-white opacity-90 mb-8">A unique scrolling experience that breaks the vertical convention</p>22 unmodified lines</section></div></div><script src="script.js"></script><script>feather.replace();</script><script src="https://deepsite.hf.co/deepsite-badge.js"></script></body></html>11 unmodified lines121314151617181920212222 unmodified lines454647484950515253545511 unmodified lines<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script></head><body class="overflow-hidden"><diagonal-navbar></diagonal-navbar><diagonal-footer></diagonal-footer><div id="diagonal-scroll-container"><div id="content-wrapper"><section class="panel bg-gradient-to-br from-indigo-500 to-purple-600 w-screen h-screen flex items-center justify-center"><div class="text-center max-w-2xl px-4"><h1 class="text-5xl md:text-7xl font-bold text-white mb-6">Scroll Diagonally</h1><p class="text-xl text-white opacity-90 mb-8">A unique scrolling experience that breaks the vertical convention</p>22 unmodified lines</section></div></div><script src="components/navbar.js"></script><script src="components/footer.js"></script><script src="script.js"></script><script>feather.replace();</script></body></html>
1237 unmodified lines111213141516171819201 unmodified line22232425262728293031323334353637382 unmodified lines4142434445464748495051document.addEventListener('DOMContentLoaded', () => {// Initialize GSAP and ScrollTriggergsap.registerPlugin(ScrollTrigger);7 unmodified linesconst totalWidth = window.innerWidth * panels.length;const totalHeight = window.innerHeight * panels.length;// Set up the diagonal scroll effectgsap.to(contentWrapper, {x: () => -Math.sqrt(2) * (totalWidth - window.innerWidth),y: () => -Math.sqrt(2) * (totalHeight - window.innerHeight),ease: 'none',scrollTrigger: {trigger: container,1 unmodified lineend: () => `+=${Math.sqrt(totalWidth * totalWidth + totalHeight * totalHeight)}`,scrub: 1,pin: true,anticipatePin: 1}});// Rotate the container for diagonal scrollinggsap.set(contentWrapper, {rotation: 45,width: totalWidth * Math.sqrt(2),height: totalHeight * Math.sqrt(2),xPercent: -50,yPercent: -50});// Handle resize events2 unmodified lines});// Smooth scroll to next panel on arrow clickdocument.querySelector('.animate-bounce').addEventListener('click', () => {gsap.to(window, {scrollTo: window.innerHeight * 0.8,duration: 1.5,ease: 'power2.inOut'});});});12347 unmodified lines12131415161718192021222324252627282930313233341 unmodified line36373839404142434445464748495051525354552 unmodified lines5859606162636465666768document.addEventListener('DOMContentLoaded', () => {// Initialize GSAP and ScrollTriggergsap.registerPlugin(ScrollTrigger);7 unmodified linesconst totalWidth = window.innerWidth * panels.length;const totalHeight = window.innerHeight * panels.length;// Set initial styles for diagonal layoutgsap.set(contentWrapper, {position: 'absolute',top: '50%',left: '50%',width: totalWidth,height: totalHeight,xPercent: -50,yPercent: -50,rotation: 45,transformOrigin: 'center center'});// Set up the diagonal scroll effectgsap.to(contentWrapper, {xPercent: -50 + (panels.length * 50),yPercent: -50 - (panels.length * 50),ease: 'none',scrollTrigger: {trigger: container,1 unmodified lineend: () => `+=${Math.sqrt(totalWidth * totalWidth + totalHeight * totalHeight)}`,scrub: 1,pin: true,anticipatePin: 1,invalidateOnRefresh: true}});// Position each panel correctlypanels.forEach((panel, i) => {gsap.set(panel, {position: 'absolute',left: i * window.innerWidth,top: 0,width: '100vw',height: '100vh'});});// Handle resize events2 unmodified lines});// Smooth scroll to next panel on arrow clickdocument.querySelector('.animate-bounce')?.addEventListener('click', () => {gsap.to(window, {scrollTo: window.innerHeight * 0.8,duration: 1.5,ease: 'power2.inOut'});});});
1236 unmodified lines1011121314151617181914 unmodified lines34353637/* Reset some default styles */* {margin: 0;6 unmodified linesfont-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}.panel {position: relative;overflow: hidden;}14 unmodified lines::-webkit-scrollbar-thumb:hover {background: rgba(255, 255, 255, 0.7);}12346 unmodified lines11121314151617181920212223242526272829303132333435363714 unmodified lines52535455565758596061/* Reset some default styles */* {margin: 0;6 unmodified linesfont-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;overflow: hidden;}#diagonal-scroll-container {position: fixed;top: 0;left: 0;width: 100vw;height: 100vh;overflow: hidden;}#content-wrapper {position: absolute;will-change: transform;}.panel {position: absolute;width: 100vw;height: 100vh;overflow: hidden;}14 unmodified lines::-webkit-scrollbar-thumb:hover {background: rgba(255, 255, 255, 0.7);}/* Ensure navbar and footer stay visible */diagonal-navbar, diagonal-footer {position: fixed;z-index: 1000;}
index.html+7-5
script.js+29-12
style.css+26-2