Elegant Friends Sidebar - 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>Elegant Friends Sidebar</title> <style> body { margin: 0; font-family: 'Arial', sans-serif; background: #eaeaea; } .sidebar { position: fixed; left: 0; top: 0; height: 100%; width: 280px; background: #fff; box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1); transition: transform 0.3s ease-in-out; transform: translateX(-100%); } .sidebar.active { transform: translateX(0); } .sidebar-header { padding: 20px; background: #1abc9c; color: #fff; text-align: center; font-size: 24px; font-weight: bold; } .sidebar-header .toggle-btn { position: absolute; right: 20px; top: 20px; cursor: pointer; } .sidebar-header .toggle-btn span { font-size: 18px; } .friends-list { padding: 20px; } .friend { display: flex; align-items: center; margin-bottom: 15px; padding: 10px; border-radius: 8px; background: #f9f9f9; transition: background 0.3s; } .friend:hover { background: #ecf0f1; } .friend img { width: 50px; height: 50px; border-radius: 50%; margin-right: 15px; } .friend-info { flex: 1; } .friend-info h4 { margin: 0; font-size: 18px; } .friend-info p { margin: 5px 0 0; font-size: 14px; color: #666; } .open-sidebar { position: absolute; left: 0; top: 50%; transform: translateY(-50%); cursor: pointer; padding: 10px; background: #1abc9c; color: #fff; border-radius: 0 5px 5px 0; transition: background 0.3s; } .open-sidebar:hover { background: #16a085; } </style> </head> <body> <div class="open-sidebar" id="open-sidebar"> <span>☰ Friends</span> </div> <div class="sidebar" id="sidebar"> <div class="sidebar-header"> Friends <div class="toggle-btn" id="toggle-btn"> <span>✕</span> </div> </div> <div class="friends-list"> <div class="friend"> <img src="https://via.placeholder.com/50" alt="Friend 1"> <div class="friend-info"> <h4>John Doe</h4> <p>Online</p> </div> </div> <div class="friend"> <img src="https://via.placeholder.com/50" alt="Friend 2"> <div class="friend-info"> <h4>Jane Smith</h4> <p>Offline</p> </div> </div> <!-- Add more friends here --> </div> </div> <script> document.getElementById('open-sidebar').addEventListener('click', function() { document.getElementById('sidebar').classList.add('active'); }); document.getElementById('sidebar').addEventListener('click', function() { document.getElementById('sidebar').classList.remove('active'); }); </script> </body> </html>