Get started with fpo CDN

MIT licensed

FPO: Lightweight library for parallax scrolling, adjusting element position based on scroll.

Tags:
  • fp
  • functional
  • programming

Stable version

Copied!

How to start using fpo CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with fpo CDN - cdnhub.io</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
  <script src="https://cdn.cdnhub.io/fpo/6.1.11/fpo.js"></script>
  <style>
    .fpo-container {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(255, 255, 255, 0.8);
      z-index: 9999;
    }
    .fpo-container .fpo-spinner {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
    }
    .fpo-container .fpo-spinner i {
      font-size: 5em;
      color: #333;
      animation: spin 1s linear infinite;
    }
    @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }
  </style>
</head>
<body>
  <div class="fpo-container">
    <div class="fpo-spinner">
      <i class="fas fa-spinner fa-pulse"></i>
    </div>
  </div>
  <h1>Welcome to FPO Example</h1>
  <button id="loadContent">Load Content</button>
  <script>
    const loadContentBtn = document.getElementById('loadContent');
    const fpoContainer = document.querySelector('.fpo-container');

    loadContentBtn.addEventListener('click', () => {
      // Replace this with your content loading logic
      setTimeout(() => {
        fpoContainer.style.display = 'none';
        document.querySelector('h1').textContent = 'Content Loaded';
      }, 3000);

      FPO.show(fpoContainer);
    });
  </script>
</body>
</html>
Copied!

All versions