CR7CR7

TilewindCSS

May 7th, 2023
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.26 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.     <head>
  4.         <meta charset="UTF-8" />
  5.         <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6.         <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7.         <title>Nav bar pinning question using GSAP</title>
  8.  
  9.         <!-- GSAP -->
  10.         <script
  11.             defer
  12.             src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.5/gsap.min.js"
  13.             integrity="sha512-cOH8ndwGgPo+K7pTvMrqYbmI8u8k6Sho3js0gOqVWTmQMlLIi6TbqGWRTpf1ga8ci9H3iPsvDLr4X7xwhC/+DQ=="
  14.             crossorigin="anonymous"
  15.             referrerpolicy="no-referrer"></script>
  16.         <script
  17.             defer
  18.             src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.5/ScrollTrigger.min.js"
  19.             integrity="sha512-AMl4wfwAmDM1lsQvVBBRHYENn1FR8cfOTpt8QVbb/P55mYOdahHD4LmHM1W55pNe3j/3od8ELzPf/8eNkkjISQ=="
  20.             crossorigin="anonymous"
  21.             referrerpolicy="no-referrer"></script>
  22.  
  23.     <!-- TailwindCSS -->
  24.     <link rel="stylesheet" href="https://cdn.tailwindcss.com">
  25.  
  26.     <!-- Custom CSS -->
  27.     <style>
  28.       @import url("https://cdn.tailwindcss.com");
  29.       @tailwind base;
  30.       @tailwind components;
  31.       @tailwind utilities;
  32.  
  33.       /* Custom styles */
  34.       .nav {
  35.         font-family: "Inter", sans-serif;
  36.         font-weight: 600;
  37.         font-size: 0.875rem;
  38.         line-height: 1.25rem;
  39.         letter-spacing: -0.025em;
  40.       }
  41.  
  42.       .nav__link {
  43.         color: #374151;
  44.         transition: color 0.3s ease-in-out;
  45.       }
  46.  
  47.       .nav__link:hover {
  48.         color: #2563EB;
  49.       }
  50.  
  51.       .logo {
  52.         width: 32px;
  53.         height: 32px;
  54.       }
  55.  
  56.       .section-1 {
  57.         background-image: url("https://images.unsplash.com/photo-1611095973763-414019e724a9?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MXx8bGFuZGluZyUyMHBhZ2V8ZW58MHx8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60");
  58.         background-size: cover;
  59.         background-position: center;
  60.       }
  61.  
  62.       .section-2 {
  63.         background-color: #F9FAFB;
  64.       }
  65.  
  66.       .section-3 {
  67.         background-color: #F3F4F6;
  68.       }
  69.     </style>
  70.  
  71.     <!-- Custom JS -->
  72.     <script>
  73.       // Wait for the page to load
  74.       window.addEventListener("load", function () {
  75.         // Select the navbar element
  76.         const nav = document.querySelector(".nav");
  77.  
  78.         // Create a ScrollTrigger instance for the navbar
  79.         Scroll
Add Comment
Please, Sign In to add comment