Swipe Button - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Swipe Button</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> <style> body { margin: 0; padding: 0; font-family: 'Arial', sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; background: linear-gradient(135deg, #ff9a9e, #fad0c4); overflow: hidden; } .swipe-button-container { position: relative; width: 350px; height: 60px; background: rgba(255, 255, 255, 0.1); border-radius: 30px; display: flex; align-items: center; padding: 5px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37); border: 1px solid rgba(255, 255, 255, 0.18); cursor: pointer; } .swipe-button { position: absolute; top: 50%; left: 5px; transform: translateY(-50%); width: 50px; height: 50px; background: linear-gradient(135deg, #ff7e5f, #feb47b); border-radius: 50%; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); display: flex; align-items: center; justify-content: center; color: #fff; transition: transform 0.3s ease, background 0.3s ease; font-size: 1.5rem; } .swipe-button:hover { background: linear-gradient(135deg, #feb47b, #ff7e5f); } .swipe-button-container.swiped .swipe-button { transform: translateY(-50%) translateX(300px); background: #4caf50; } .swipe-button-container.swiped .swipe-button::before { content: "\f00c"; font-family: 'Font Awesome 5 Free'; font-weight: 900; color: #fff; } .swipe-button-container::before { content: "Swipe"; position: absolute; top: 50%; left: 70px; transform: translateY(-50%); font-size: 1.2rem; color: #fff; font-weight: bold; } </style> </head> <body> <div class="swipe-button-container" id="swipeButton"> <div class="swipe-button"> <i class="fas fa-arrow-right"></i> </div> </div> <script> const swipeButton = document.getElementById('swipeButton'); swipeButton.addEventListener('click', () => { swipeButton.classList.toggle('swiped'); }); </script> </body> </html>