Skip to content

um-xair/html-css-js-restaurant-menu-website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧬 Responsive Restaurant Menu Website | by UM-XAIR


This HTML and JavaScript code creates a simple menu website where users can view different food items and their prices. This code creates a basic menu website with interactive features for browsing different food items. Here's an explanation of the code:

HTML Structure:

  • The HTML file starts with the <!DOCTYPE html> declaration, indicating that this is an HTML5 document.
  • Inside the <head> section, there are meta tags for defining the character set and viewport settings, as well as a title for the webpage.
  • External CSS and Bootstrap Icons libraries are linked using <link> tags.
  • The <body> section contains the main content of the webpage, including the header, navigation, sections, and footer.

Header Section:

  • The <header> contains the logo, navigation menu, and a section for displaying the current food item.
  • The logo and navigation menu are wrapped inside a <nav> element.
  • The left menu links are placed inside a <div> with the class left_menu.
  • Inside the <section>, there is a <div> with the class content for displaying the current food item's title, description, and price.
  • Below the content div, there is another <div> with the class cards, which contains multiple food cards.

JavaScript (app.js):

  • The JavaScript code starts by selecting the left and right arrow icons for scrolling through the food cards and the container div for the food cards.
  • Event listeners are added to the left and right arrow icons to scroll the container div left or right when clicked.
  • An event listener is added to each food card, so when a card is clicked, its image, title, and price are displayed in the content div at the top.

Explanation of Specific Parts:

  • The scrollLeft property is used to scroll the container horizontally.
  • The poster, title, and price_cont variables are used to reference the elements that will display the current food item's image, title, and price, respectively.
  • The Array.from(document.getElementsByClassName('card')) loop iterates over each food card and adds a click event listener to each one. When a card is clicked, it updates the content at the top of the page with the details of the selected food item.

Inspiration from the KDS Coder YouTube channel 🫶


Connect with Me 🌐

tiktok email