Fitness Pin Board - 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>Fitness Pin Board</title> <style> body { font-family: 'Arial', sans-serif; background: #e8eaf6; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .pinboard { background: #ffffff; width: 90vw; max-width: 1200px; height: 80vh; border-radius: 15px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); position: relative; overflow: auto; padding: 20px; } .pinboard-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #c5cae9; padding-bottom: 10px; } .pinboard-title { font-size: 2rem; color: #3949ab; } .add-pin-button { background: #3949ab; color: white; border: none; border-radius: 5px; padding: 10px 20px; cursor: pointer; font-size: 1rem; transition: background 0.3s ease; } .add-pin-button:hover { background: #303f9f; } .pins-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-top: 20px; } .pin { background: #ffffff; border-radius: 10px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); padding: 15px; position: relative; animation: fadeIn 0.5s ease-in-out; } .pin .delete-pin { background: transparent; border: none; color: #3949ab; font-size: 1.5rem; position: absolute; top: 10px; right: 10px; cursor: pointer; } .pin .delete-pin:hover { color: #303f9f; } .pin-content { margin-top: 10px; } @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } .modal { display: none; position: fixed; z-index: 1; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.4); justify-content: center; align-items: center; } .modal-content { background-color: #fefefe; margin: auto; padding: 20px; border: 1px solid #888; width: 80%; max-width: 400px; border-radius: 10px; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); animation: fadeIn 0.3s ease-in-out; } .close { color: #aaa; float: right; font-size: 28px; font-weight: bold; } .close:hover, .close:focus { color: black; text-decoration: none; cursor: pointer; } .modal-input { width: 95%; padding: 10px; margin: 10px 0; border-radius: 5px; border: 1px solid #ccc; } .submit-button { background: #3949ab; color: white; border: none; border-radius: 5px; padding: 10px 20px; cursor: pointer; font-size: 1rem; transition: background 0.3s ease; width: 100%; } .submit-button:hover { background: #303f9f; } </style> </head> <body> <div class="pinboard"> <div class="pinboard-header"> <div class="pinboard-title">💪 Fitness PinBoard</div> <button type="button" class="add-pin-button">➕ Add Pin</button> </div> <div class="pins-container"></div> </div> <div id="pinModal" class="modal"> <div class="modal-content"> <span class="close">×</span> <textarea class="modal-input" placeholder="Enter pin content"></textarea> <button type="button" class="submit-button">Add Pin</button> </div> </div> <script> const modal = document.getElementById('pinModal'); const btn = document.querySelector('.add-pin-button'); const span = document.querySelector('.close'); const submitBtn = document.querySelector('.submit-button'); btn.onclick = function() { modal.style.display = 'flex'; } span.onclick = function() { modal.style.display = 'none'; } window.onclick = function(event) { if (event.target == modal) { modal.style.display = 'none'; } } submitBtn.onclick = function() { const pinContent = document.querySelector('.modal-input').value; if (pinContent) { const pinContainer = document.querySelector('.pins-container'); const pinElement = document.createElement('div'); pinElement.classList.add('pin'); pinElement.innerHTML = ` <button class="delete-pin">❌</button> <div class="pin-content">${pinContent}</div> `; pinContainer.appendChild(pinElement); pinElement.querySelector('.delete-pin').addEventListener('click', () => { pinContainer.removeChild(pinElement); }); modal.style.display = 'none'; document.querySelector('.modal-input').value = ''; } } </script> </body> </html>