James Williams
Birmingham Newman University
jwilliams@staff.newman.ac.uk
3-hour session
Advanced Components:
Modal Dialogs
Carousel/Slideshow
Accordion/Collapse
Tabs & Pills
Progress Bars
Spinners & Loaders
Toast Notifications
Offcanvas Sidebar
Dropdown Menus
Tooltips & Popovers
<!-- Modal Trigger -->
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#productModal">
View Product Details
</button>
<!-- Modal -->
<div class="modal fade" id="productModal" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Product Details</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
Product content here...
</div>
</div>
</div>
</div>
Try it yourself: Click the button below to see a modal in action!
In Stock
High-quality wireless headphones with noise cancellation, 30-hour battery life, and premium sound quality.
<div id="productCarousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#productCarousel" data-bs-slide-to="0" class="active"></button>
<button type="button" data-bs-target="#productCarousel" data-bs-slide-to="1"></button>
</div>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="product1.jpg" class="d-block w-100" alt="Product 1">
</div>
<div class="carousel-item">
<img src="product2.jpg" class="d-block w-100" alt="Product 2">
</div>
</div>
</div>
Try it yourself: Use the arrows or indicators to navigate through product images!
Premium wireless headphones - front perspective
Showcasing the sleek design and premium materials
Close-up of the premium leather cushions
<div class="accordion" id="productAccordion">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne">
Product Description
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse show" data-bs-parent="#productAccordion">
<div class="accordion-body">
Product details here...
</div>
</div>
</div>
</div>
Try it yourself: Click on the sections to expand/collapse product information!
<ul class="nav nav-tabs" id="productTabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="details-tab" data-bs-toggle="tab" data-bs-target="#details">Details</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="reviews-tab" data-bs-toggle="tab" data-bs-target="#reviews">Reviews</button>
</li>
</ul>
<div class="tab-content" id="productTabsContent">
<div class="tab-pane fade show active" id="details">Details content...</div>
<div class="tab-pane fade" id="reviews">Reviews content...</div>
</div>
Try it yourself: Click on different tabs to switch between content sections!
Our premium wireless headphones combine cutting-edge technology with exceptional comfort. Whether you're commuting, working, or relaxing, these headphones deliver an unparalleled audio experience.
Key Highlights:
Custom 40mm drivers deliver rich, detailed sound across all frequencies.
Advanced ANC technology blocks up to 95% of ambient noise.
Touch controls for music, calls, and voice assistant activation.
Dual microphone array with beamforming technology.
| Feature | Standard | Premium | Pro |
|---|---|---|---|
| Battery Life | 20h | 30h | 40h |
| Noise Cancellation | Basic | Advanced | Premium |
| Price | $99 | $199 | $299 |
Need help? We're here for you!
Warranty Information:
All products come with a 2-year manufacturer warranty covering defects in materials and workmanship.
CSS Custom Properties:
:root {
--bs-primary: #ff6b6b;
--bs-secondary: #ee5a24;
--bs-success: #28a745;
--bs-info: #17a2b8;
--bs-warning: #ffc107;
--bs-danger: #dc3545;
--bs-light: #f8f9fa;
--bs-dark: #343a40;
}
Custom Button Styles:
.btn-ecommerce {
background: linear-gradient(135deg, #ff6b6b, #ee5a24);
border: none;
color: white;
padding: 12px 24px;
border-radius: 25px;
font-weight: 600;
transition: all 0.3s ease;
}
.btn-ecommerce:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}
Responsive Display Classes:
d-none d-md-block
d-block d-md-none
d-flex d-md-none
d-none d-md-flex
Responsive Spacing:
mt-0 mt-md-3
p-2 p-md-4
mx-auto mx-md-0
Responsive Text:
text-center text-md-start
fs-6 fs-md-4
fw-normal fw-md-bold
Product Grid Layout:
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-4">
<div class="col">
<div class="card h-100">
<img src="product.jpg" class="card-img-top" alt="Product">
<div class="card-body d-flex flex-column">
<h5 class="card-title">Product Name</h5>
<p class="card-text flex-grow-1">Description...</p>
<button class="btn btn-primary mt-auto">Add to Cart</button>
</div>
</div>
</div>
</div>
Try it yourself: Hover over cards to see effects and click buttons to interact!
Premium sound quality with active noise cancellation.
Track your fitness and stay connected on the go.
Waterproof design with 20-hour battery life.
Try it yourself: Adjust quantities and see the total update in real-time!
Cart Layout Structure:
<div class="container">
<div class="row">
<div class="col-lg-8">
<!-- Cart Items -->
<div class="card">
<div class="card-body">
<h5 class="card-title">Shopping Cart</h5>
<!-- Cart items list -->
</div>
</div>
</div>
<div class="col-lg-4">
<!-- Order Summary -->
<div class="card">
<div class="card-body">
<h5 class="card-title">Order Summary</h5>
<!-- Summary details -->
</div>
</div>
</div>
</div>
</div>
Filter Sidebar Structure:
<div class="col-md-3">
<div class="card">
<div class="card-body">
<h5 class="card-title">Filters</h5>
<!-- Price Range -->
<div class="mb-3">
<label class="form-label">Price Range</label>
<input type="range" class="form-range" min="0" max="1000">
</div>
<!-- Categories -->
<div class="mb-3">
<label class="form-label">Categories</label>
<div class="form-check">
<input class="form-check-input" type="checkbox">
<label class="form-check-label">Electronics</label>
</div>
</div>
</div>
</div>
</div>
Time: 45 minutes
This task will help you master advanced Bootstrap components
Take a break, ask questions, or catch up on the previous task.
Next: Secondary slides and Task 2
Custom JavaScript for E-commerce:
// Shopping cart functionality
function addToCart(productId, quantity) {
let cart = JSON.parse(localStorage.getItem('cart')) || [];
cart.push({ id: productId, quantity: quantity });
localStorage.setItem('cart', JSON.stringify(cart));
updateCartDisplay();
}
// Update cart display
function updateCartDisplay() {
let cart = JSON.parse(localStorage.getItem('cart')) || [];
document.getElementById('cart-count').textContent = cart.length;
}
Lazy Loading Example:
<img src="placeholder.jpg" data-src="product.jpg" class="lazy">
// Lazy loading script
document.addEventListener("DOMContentLoaded", function() {
var lazyImages = [].slice.call(document.querySelectorAll("img.lazy"));
// Implementation here...
});
Accessibility Examples:
<button aria-label="Add product to cart">Add to Cart</button>
<img src="product.jpg" alt="Red running shoes with white sole">
<div role="main" aria-label="Product catalog">
<!-- Content -->
</div>
Feature Detection Example:
if ('IntersectionObserver' in window) {
// Use modern lazy loading
const observer = new IntersectionObserver(callback);
} else {
// Fallback for older browsers
loadAllImages();
}
Time: 45 minutes
This task will help you build a complete e-commerce interface
PHP Fundamentals & Server Setup - Introduction to server-side programming