A fully functional restaurant website built using HTML, CSS, and vanilla JavaScript with extensive DOM manipulation.
This project demonstrates advanced DOM manipulation techniques to create an interactive restaurant ordering website. All content is dynamically generated using JavaScript, including menu items, reviews, and cart functionality.
- All menu items rendered using DOM manipulation from JSON data structure
- Products organized by categories (Burgers, Fries, Cold Drinks)
- Dynamic creation of HTML elements using
createElement(),appendChild(), etc.
- β Add items to cart with single click
- π Real-time cart badge counter
- π Shopping cart modal popup
- ββ Increase/decrease item quantities
- π° Automatic price calculation
- πΎ Cart persistence using LocalStorage
- π± Interactive review carousel
βοΈ βΆοΈ Previous/Next navigation buttons- π Displays 3 reviews at a time
- β Star ratings and customer details
- πͺ Grid display of partner restaurants
- πΌοΈ Logo images with restaurant names
- Generated dynamically from data structure
- π Tab-based navigation
- Filter menu items by category
- Active state indication
- π± Mobile-friendly layout
- π» Tablet and desktop optimization
- π¨ Matches Figma design specifications
src/
βββ index.html (clean, no inline code)
βββ output.css (existing Tailwind)
βββ input.css (existing)
βββ css/
β βββ styles.css (NEW - all custom styles)
βββ js/
β βββ main.js (NEW - all JavaScript)
βββ assets/
βββ images/
The project uses a JSON-based data structure to organize restaurant information:
{
name: "Restaurant Name",
rating: 3.4,
products: [
{
id: 1,
name: "Product Name",
price: 23.10,
category: "burgers",
image: "path/to/image",
description: "Product description"
}
],
reviews: [...],
similarRestaurants: [...]
}document.createElement()- Create new elementselement.appendChild()- Add elements to DOMelement.innerHTML- Set inner HTML contentelement.textContent- Set text content
document.getElementById()- Select by IDdocument.querySelectorAll()- Select multiple elementsdocument.querySelector()- Select single element
addEventListener()- Attach event listeners- Click events for buttons and cart items
- Form submission handling
- Modal interactions
element.classList.add/remove()- Toggle classeselement.style.property- Direct style manipulation- CSS class management for active states
-
Clone or download the project
cd "src/pages"
-
Open in browser
- Open
index.htmlin any modern web browser - Or use Live Server extension in VS Code
- Open
-
Interact with the website
- Browse menu items
- Add items to cart
- View shopping cart modal
- Navigate through reviews
- Filter by categories
function addToCart(product) {
const existingItem = cart.find((item) => item.id === product.id);
if (existingItem) {
existingItem.quantity++;
} else {
cart.push({ ...product, quantity: 1 });
}
updateCartUI();
}function createMenuItemElement(product) {
const item = document.createElement("div");
item.className = "menu-item";
// ... create child elements
return item;
}function nextReview() {
if (currentReviewIndex < reviews.length - 3) {
currentReviewIndex++;
renderReviews();
}
}- Color Scheme: Orange (#FC8A06) and Navy (#03081F)
- Typography: Poppins font family
- Components: Cards, modals, buttons, badges
- Animations: Smooth transitions and hover effects
- Layout: CSS Grid and Flexbox
- Mobile: < 640px
- Tablet: 640px - 968px
- Desktop: > 968px
- HTML5
- CSS3 (Flexbox, Grid, Animations)
- Vanilla JavaScript (ES6+)
- DOM Manipulation
- Cart data persists across page refreshes
- Automatic save on cart updates
- Load cart on page initialization
This project demonstrates:
- β Advanced DOM manipulation
- β Dynamic content generation
- β Event handling and delegation
- β LocalStorage API usage
- β Responsive web design
- β Clean code organization
- β JSON data structures
- All images are loaded from
../assets/images/directory - Cart data is stored in browser's LocalStorage
- The design closely follows the provided Figma specifications
- All interactive features work without any external libraries
- Search functionality for menu items
- User authentication
- Order history
- Payment integration
- Real-time order tracking
- Multiple location support
This project is for educational purposes.
Happy Coding! ππ