Friend Finder Delight - 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>Friend Finder Delight</title> <style> body { font-family: 'Arial', sans-serif; background: #f5f7fa; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .search-container { background: #ffffff; border-radius: 10px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); padding: 20px; width: 350px; text-align: center; position: relative; } .search-container h2 { margin: 0; font-size: 22px; color: #333; margin-bottom: 15px; } .search-container input[type="text"] { width: 90%; padding: 10px 15px; margin: 10px 0; border: 2px solid #ddd; border-radius: 25px; font-size: 16px; outline: none; transition: border 0.3s; } .search-container input[type="text"]:focus { border-color: #ff7f50; } .search-container button { padding: 10px 20px; border: none; background: #ff7f50; color: #fff; border-radius: 25px; cursor: pointer; font-size: 16px; transition: background 0.3s; } .search-container button:hover { background: #ff4500; } .results { margin-top: 20px; text-align: left; } .results .friend { display: flex; align-items: center; background: #f9f9f9; border-radius: 10px; padding: 10px; margin-bottom: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); transition: transform 0.3s; } .results .friend:hover { transform: translateY(-5px); } .results img { border-radius: 50%; width: 50px; height: 50px; margin-right: 15px; } .results .friend-info { flex: 1; } .results .friend-info h3 { margin: 0; font-size: 18px; color: #333; } .results .friend-info p { margin: 5px 0 0; color: #666; } .emoji { display: inline-block; margin-left: 10px; animation: emoji-bounce 1.5s infinite; } @keyframes emoji-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } } .no-results { font-size: 16px; color: #999; margin-top: 20px; } .suggestions { background: #fff; border: 1px solid #ddd; border-radius: 5px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); position: absolute; width: calc(100% - 40px); z-index: 10; max-height: 150px; overflow-y: auto; display: none; left: 50%; transform: translateX(-50%); } .suggestions div { padding: 10px; cursor: pointer; transition: background 0.3s; } .suggestions div:hover { background: #f1f1f1; } </style> </head> <body> <div class="search-container"> <h2>Friend Finder Delight <span class="emoji">🔍</span></h2> <input type="text" id="friendSearch" placeholder="Type a name..." oninput="showSuggestions()"> <div class="suggestions" id="suggestions"></div> <button onclick="searchFriends()">Search</button> <div class="results" id="results"></div> <div class="no-results" id="noResults" style="display: none;">No friends found <span class="emoji">😢</span></div> </div> <script> const friends = [ { name: 'Alice Johnson', avatar: 'https://via.placeholder.com/50' }, { name: 'Bob Smith', avatar: 'https://via.placeholder.com/50' }, { name: 'Charlie Brown', avatar: 'https://via.placeholder.com/50' }, { name: 'David Wilson', avatar: 'https://via.placeholder.com/50' }, { name: 'Emma Davis', avatar: 'https://via.placeholder.com/50' }, // Add more friends here ]; function showSuggestions() { const query = document.getElementById('friendSearch').value.toLowerCase(); const suggestions = document.getElementById('suggestions'); suggestions.innerHTML = ''; if (query) { const filteredFriends = friends.filter(friend => friend.name.toLowerCase().includes(query)); filteredFriends.forEach(friend => { const suggestion = document.createElement('div'); suggestion.innerText = friend.name; suggestion.onclick = () => { document.getElementById('friendSearch').value = friend.name; suggestions.style.display = 'none'; }; suggestions.appendChild(suggestion); }); suggestions.style.display = 'block'; } else { suggestions.style.display = 'none'; } } function searchFriends() { const query = document.getElementById('friendSearch').value.toLowerCase(); const results = document.getElementById('results'); const noResults = document.getElementById('noResults'); const suggestions = document.getElementById('suggestions'); results.innerHTML = ''; noResults.style.display = 'none'; suggestions.style.display = 'none'; const filteredFriends = friends.filter(friend => friend.name.toLowerCase().includes(query)); if (filteredFriends.length > 0) { filteredFriends.forEach(friend => { const friendElement = document.createElement('div'); friendElement.classList.add('friend'); friendElement.innerHTML = ` <img src="${friend.avatar}" alt="${friend.name}"> <div class="friend-info"> <h3>${friend.name}</h3> <p>Online now <span class="emoji">💬</span></p> </div> `; results.appendChild(friendElement); }); } else { noResults.style.display = 'block'; } } </script> </body> </html>