gpt-3.5-turbo-0613· openai
Suzhen/CodeChat
Напиши на JS + Vue.js (version3) идеальное бургер меню
- User
Напиши на JS + Vue.js (version3) идеальное бургер меню
- Assistant
Вот пример идеального бургер-меню на JS + Vue.js (v3):
<!DOCTYPE html> <html> <head> <title>Ideal Burger Menu</title> <script src="https://unpkg.com/vue@next"></script> <style> .navbar { display: flex; justify-content: space-between; align-items: center; background-color: #333; color: #fff; padding: 10px; font-family: Arial, sans-serif; } .menu-toggle { display: none; cursor: pointer; font-size: 20px; } .navbar ul { display: flex; list-style: none; margin: 0; padding: 0; } .navbar li { margin-right: 10px; } .navbar a { color: #fff; text-decoration: none; padding: 5px; } @media (max-width: 768px) { .menu-toggle { display: block; } .navbar ul { display: none; } .navbar.active ul { display: flex; flex-direction: column; align-items: center; background-color: #333; position: absolute; top: 100%; left: 0; width: 100%; } .navbar.active li { margin: 10px 0; } } </style> </head> <body> <div id="app"> <nav class="navbar" :class="{ active: showMenu }"> <div class="menu-toggle" @click="toggleMenu">☰</div> <ul> <li><a href="#">Home</a></li> <li><a href="#">Menu</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> </nav> </div> <script> const app = Vue.createApp({ data() { return { showMenu: false } }, methods: { toggleMenu() { this.showMenu = !this.showMenu; } } }); app.mount("#app"); </script> </body> </html>