Bootstrap 5 Product Tour with Navbar, Cards and Gallery
A landing page with a sticky navbar, search field, profile cards and a masonry gallery, plus a guided popover tour that highlights each area step by step.
<div class="wdw-page">
<header class="wdw-header sticky-top">
<nav class="navbar navbar-expand-lg py-2" aria-label="Main" id="tourNav">
<div class="container">
<a class="navbar-brand d-flex align-items-center gap-2 fw-bold wdw-heading" href="#"><span class="wdw-logo" aria-hidden="true">T</span> Tourist</a>
<button class="navbar-toggler border-0 shadow-none" type="button" data-bs-toggle="collapse" data-bs-target="#tourMenu" aria-controls="tourMenu" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="tourMenu">
<ul class="navbar-nav me-auto mt-3 mt-lg-0">
<li class="nav-item"><a class="nav-link active" aria-current="page" href="#">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#">Features</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Explore</a>
<ul class="dropdown-menu"><li><a class="dropdown-item" href="#">Photography</a></li><li><a class="dropdown-item" href="#">Culinary</a></li><li><hr class="dropdown-divider"></li><li><a class="dropdown-item" href="#">All topics</a></li></ul>
</li>
</ul>
<form class="d-flex mt-3 mt-lg-0" role="search" id="tourSearch" onsubmit="return false">
<input class="form-control rounded-pill" type="search" placeholder="Search" aria-label="Search" style="min-width: 14rem">
</form>
</div>
</div>
</nav>
</header>
<main class="container py-4" style="max-width: 1040px">
<section class="text-center mb-4">
<span class="wdw-eyebrow">Interactive guide</span>
<h1 class="wdw-heading display-5 mt-1 mb-2">Bootstrap Tour</h1>
<p class="wdw-muted mx-auto mb-4" style="max-width: 32rem">Walk new visitors through the navigation, search, cards and gallery in four short steps.</p>
<button type="button" class="btn btn-primary rounded-pill px-4" id="startTour">Start the tour</button>
</section>
<section class="mb-4" id="tourCards" aria-labelledby="cardsTitle">
<h2 class="h5 wdw-heading mb-3" id="cardsTitle">Cascading cards</h2>
<div class="row g-4">
<div class="col-md-4"><article class="card wdw-card-sm h-100 border-0 overflow-hidden">
<img src="https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=600&h=400&fit=crop&q=80" class="card-img-top" alt="Portrait of a smiling woman" height="200" style="object-fit:cover">
<div class="card-body p-4"><h3 class="h6 mb-0 wdw-heading">Alison Belmont</h3><p class="text-primary small fw-semibold mb-2">Graffiti artist</p><p class="small wdw-muted mb-3">Large-scale murals that turn blank walls into landmarks.</p><a href="#" class="btn btn-sm btn-outline-primary rounded-pill">View profile</a></div></article></div>
<div class="col-md-4"><article class="card wdw-card-sm h-100 border-0 overflow-hidden">
<img src="https://images.unsplash.com/photo-1414235077428-338989a2e8c0?w=600&h=400&fit=crop&q=80" class="card-img-top" alt="A plated restaurant dish" height="200" style="object-fit:cover">
<div class="card-body p-4"><span class="badge rounded-pill mb-2 bg-primary-subtle text-primary-emphasis">Culinary</span><h3 class="h6 wdw-heading">Cheat day inspirations</h3><p class="small wdw-muted mb-3">Five plates worth breaking the rules for this weekend.</p><a href="#" class="btn btn-sm btn-outline-primary rounded-pill">Read more</a></div></article></div>
<div class="col-md-4"><article class="card wdw-card-sm h-100 border-0 overflow-hidden">
<img src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=600&h=400&fit=crop&q=80" class="card-img-top" alt="Sunlight through a forest" height="200" style="object-fit:cover">
<div class="card-body p-4"><h3 class="h6 mb-0 wdw-heading">Billy Coleman</h3><p class="text-primary small fw-semibold mb-2">Web developer</p><p class="small wdw-muted mb-3">Builds fast, accessible interfaces from quiet corners of the world.</p><a href="#" class="btn btn-sm btn-outline-primary rounded-pill">View profile</a></div></article></div>
</div>
</section>
<section id="tourGallery" aria-labelledby="galTitle">
<h2 class="h5 wdw-heading mb-3" id="galTitle">Image gallery</h2>
<div class="wdw-gallery">
<button type="button" class="wdw-shot tall" data-full="https://images.unsplash.com/photo-1506744038136-46273834b3fb?w=1400&q=80" data-alt="Mountain ridge at sunrise" aria-label="View larger: Mountain ridge at sunrise"><img src="https://images.unsplash.com/photo-1506744038136-46273834b3fb?w=600&q=80" alt="Mountain ridge at sunrise"></button>
<button type="button" class="wdw-shot " data-full="https://images.unsplash.com/photo-1469474968028-56623f02e42e?w=1400&q=80" data-alt="Misty valley with green hills" aria-label="View larger: Misty valley with green hills"><img src="https://images.unsplash.com/photo-1469474968028-56623f02e42e?w=600&q=80" alt="Misty valley with green hills"></button>
<button type="button" class="wdw-shot " data-full="https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=1400&q=80" data-alt="Sunlit trail through tall trees" aria-label="View larger: Sunlit trail through tall trees"><img src="https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=600&q=80" alt="Sunlit trail through tall trees"></button>
<button type="button" class="wdw-shot wide" data-full="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=1400&q=80" data-alt="Wide view of a foggy forest" aria-label="View larger: Wide view of a foggy forest"><img src="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=600&q=80" alt="Wide view of a foggy forest"></button>
<button type="button" class="wdw-shot " data-full="https://images.unsplash.com/photo-1501785888041-af3ef285b470?w=1400&q=80" data-alt="Lake surrounded by mountains" aria-label="View larger: Lake surrounded by mountains"><img src="https://images.unsplash.com/photo-1501785888041-af3ef285b470?w=600&q=80" alt="Lake surrounded by mountains"></button>
<button type="button" class="wdw-shot wide" data-full="https://images.unsplash.com/photo-1518837695005-2083093ee35b?w=1400&q=80" data-alt="Ocean wave breaking on a beach" aria-label="View larger: Ocean wave breaking on a beach"><img src="https://images.unsplash.com/photo-1518837695005-2083093ee35b?w=600&q=80" alt="Ocean wave breaking on a beach"></button>
</div>
</section>
</main>
<div class="modal fade" id="shotModal" tabindex="-1" aria-label="Image preview" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg"><div class="modal-content border-0 overflow-hidden">
<button type="button" class="btn-close position-absolute top-0 end-0 m-3 z-1 bg-body rounded-circle p-2" data-bs-dismiss="modal" aria-label="Close"></button>
<img src="https://images.unsplash.com/photo-1506744038136-46273834b3fb?w=1400&q=80" alt="Mountain ridge at sunrise" id="shotImg" class="img-fluid w-100">
</div></div>
</div>
</div>
/* Web Designer Wall library style — shared base for every Bootstrap 5 snippet.
Indigo accent, Plus Jakarta Sans, soft cards, pill buttons. Works in light and dark. */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");
:root,
[data-bs-theme="light"] {
--wdw-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--bs-body-font-family: var(--wdw-font);
--bs-primary: #4f46e5;
--bs-primary-rgb: 79, 70, 229;
--bs-primary-text-emphasis: #3730a3;
--bs-primary-bg-subtle: #eef2ff;
--bs-primary-border-subtle: #c7d2fe;
--bs-link-color: #4f46e5;
--bs-link-color-rgb: 79, 70, 229;
--bs-link-hover-color: #4338ca;
--bs-link-hover-color-rgb: 67, 56, 202;
--bs-focus-ring-color: rgba(79, 70, 229, 0.25);
--bs-border-radius: 0.75rem;
--bs-border-radius-lg: 1rem;
--bs-border-radius-xl: 1.25rem;
--wdw-radius-card: 1.25rem;
--wdw-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 16px 40px -16px rgba(16, 24, 40, 0.22);
--wdw-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px -4px rgba(16, 24, 40, 0.12);
--wdw-stage: #f5f6fb;
}
[data-bs-theme="dark"] {
--bs-primary: #818cf8;
--bs-primary-rgb: 129, 140, 248;
--bs-primary-text-emphasis: #c7d2fe;
--bs-primary-bg-subtle: rgba(129, 140, 248, 0.14);
--bs-primary-border-subtle: rgba(129, 140, 248, 0.35);
--bs-link-color: #a5b4fc;
--bs-link-color-rgb: 165, 180, 252;
--bs-link-hover-color: #c7d2fe;
--bs-link-hover-color-rgb: 199, 210, 254;
--bs-focus-ring-color: rgba(129, 140, 248, 0.35);
--wdw-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
--wdw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
--wdw-stage: #0f1117;
}
body { font-family: var(--wdw-font); -webkit-font-smoothing: antialiased; }
/* Bootstrap compiles its blue into these components; point them at the accent. */
.btn-primary {
--bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
--bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
--bs-btn-disabled-bg: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0f1117; --bs-btn-hover-bg: #a5b4fc; --bs-btn-hover-border-color: #a5b4fc; --bs-btn-hover-color: #0f1117; --bs-btn-active-color: #0f1117; }
.btn-outline-primary {
--bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary);
--bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn { --bs-btn-font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.btn-sm { min-height: 36px; }
.form-control, .form-select { min-height: 44px; border-radius: .75rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: rgba(var(--bs-primary-rgb), .6); box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--bs-primary); }
.nav { --bs-nav-link-color: var(--bs-secondary-color); --bs-nav-link-hover-color: var(--bs-emphasis-color); }
.pagination { --bs-pagination-active-bg: var(--bs-primary); --bs-pagination-active-border-color: var(--bs-primary); --bs-pagination-color: var(--bs-body-color); --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--bs-primary); }
.list-group { --bs-list-group-active-bg: var(--bs-primary); --bs-list-group-active-border-color: var(--bs-primary); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--bs-primary); border-radius: .875rem; box-shadow: var(--wdw-shadow-sm); }
.accordion { --bs-accordion-active-bg: var(--bs-primary-bg-subtle); --bs-accordion-active-color: var(--bs-primary-text-emphasis); --bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.badge { font-weight: 600; }
/* Library building blocks — use these instead of re-inventing them per snippet. */
.wdw-stage { min-height: 100vh; display: flex; align-items: center; background: var(--wdw-stage); padding-block: 3rem; }
.wdw-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: var(--wdw-radius-card); box-shadow: var(--wdw-shadow); }
.wdw-card-sm { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 1rem; box-shadow: var(--wdw-shadow-sm); }
.wdw-aurora { position: relative; color: #fff; background: radial-gradient(60% 55% at 100% 0, #818cf8 0, transparent 70%), radial-gradient(65% 60% at 0 100%, #ec4899 0, transparent 65%), #1e1b4b; }
.wdw-eyebrow { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-primary); }
.wdw-heading { font-weight: 800; letter-spacing: -.02em; color: var(--bs-emphasis-color); }
.wdw-muted { color: var(--bs-secondary-color); }
.wdw-icon { width: 2.75rem; height: 2.75rem; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: .875rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
/* Component */
.wdw-page { min-height: 100vh; background: var(--wdw-stage); }
.wdw-header { background: color-mix(in srgb, var(--bs-body-bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--bs-border-color-translucent); }
.wdw-logo { width: 2rem; height: 2rem; display: inline-grid; place-items: center; border-radius: .6rem; background: var(--bs-primary); color: #fff; font-weight: 800; }
[data-bs-theme="dark"] .wdw-logo { color: #0f1117; }
.wdw-header .nav-link { font-weight: 500; }
.wdw-header .nav-link.active { color: var(--bs-primary); font-weight: 600; }
.wdw-gallery { display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 8rem; grid-auto-flow: dense; gap: 1rem; }
.wdw-shot { position: relative; display: block; padding: 0; border: 0; border-radius: 1rem; overflow: hidden; box-shadow: var(--wdw-shadow-sm); background: var(--bs-tertiary-bg); cursor: zoom-in; }
.wdw-shot.tall { grid-row: span 2; }
.wdw-shot.wide { grid-column: span 2; }
.wdw-shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.wdw-shot::after { content: ""; position: absolute; inset: 0; background: rgba(30,27,75,.35) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3M11 8v6M8 11h6'/%3E%3C/svg%3E") center/2rem no-repeat; opacity: 0; transition: opacity .2s; }
.wdw-shot:hover::after, .wdw-shot:focus-visible::after { opacity: 1; }
.wdw-shot:hover img { transform: scale(1.04); }
.wdw-shot:focus-visible { outline: 3px solid var(--bs-primary); outline-offset: 3px; }
@media (min-width: 576px) { .wdw-gallery { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 9rem; } }
.wdw-tour-target { position: relative; z-index: 1056; box-shadow: 0 0 0 4px var(--bs-primary), 0 0 0 9999px rgba(15, 17, 23, .5); border-radius: 1rem; transition: box-shadow .2s; }
.popover { --bs-popover-max-width: 300px; --bs-popover-border-radius: 1rem; z-index: 1060; box-shadow: var(--wdw-shadow); }
.popover-body { padding: 1rem; }
function initTour() {
var startBtn = document.getElementById('startTour');
if (!startBtn) return;
var steps = [
{ sel: '#tourNav .navbar-brand', title: 'Navigation', text: 'The brand and main links keep every visitor oriented.', place: 'bottom' },
{ sel: '#tourSearch', title: 'Search', text: 'Find any article or profile in a couple of keystrokes.', place: 'bottom' },
{ sel: '#tourCards', title: 'Cards', text: 'Profiles and posts sit side by side as scannable cards.', place: 'top' },
{ sel: '#tourGallery', title: 'Gallery', text: 'A masonry gallery showcases your best imagery.', place: 'top' }
];
var index = -1, popover = null, current = null;
function visible(el) { return el && el.getClientRects().length > 0; }
function clear() {
if (popover) { popover.dispose(); popover = null; }
if (current) { current.classList.remove('wdw-tour-target'); current = null; }
}
function end() { clear(); index = -1; startBtn.focus(); }
function show(i) {
clear();
index = i;
var step = steps[i];
var el = document.querySelector(step.sel);
if (!visible(el)) { if (i < steps.length - 1) return show(i + 1); return end(); }
current = el;
el.classList.add('wdw-tour-target');
el.scrollIntoView({ block: 'center', behavior: 'smooth' });
var wrap = document.createElement('div');
wrap.innerHTML = '<p class="small mb-3">' + step.text + '</p><div class="d-flex align-items-center justify-content-between gap-2"><span class="small wdw-muted" aria-live="polite">Step ' + (i + 1) + ' / ' + steps.length + '</span><div class="d-flex gap-2"><button type="button" class="btn btn-sm btn-outline-secondary rounded-pill" data-tour="skip">Skip</button><button type="button" class="btn btn-sm btn-primary rounded-pill" data-tour="next">' + (i === steps.length - 1 ? 'Done' : 'Next') + '</button></div></div>';
popover = new bootstrap.Popover(el, { title: step.title, content: wrap, html: true, placement: step.place, trigger: 'manual', container: 'body', fallbackPlacements: ['bottom', 'top'] });
el.addEventListener('shown.bs.popover', function onShown() {
el.removeEventListener('shown.bs.popover', onShown);
var tip = document.getElementById(el.getAttribute('aria-describedby'));
if (!tip) return;
var head = tip.querySelector('.popover-header');
if (head) head.id = 'tourTitle';
tip.setAttribute('role', 'dialog');
tip.setAttribute('aria-labelledby', 'tourTitle');
tip.setAttribute('aria-modal', 'false');
});
popover.show();
wrap.addEventListener('click', function (e) {
var b = e.target.closest('[data-tour]');
if (!b) return;
if (b.dataset.tour === 'skip' || i === steps.length - 1) end(); else show(i + 1);
});
var next = wrap.querySelector('[data-tour="next"]');
setTimeout(function () { if (next) next.focus({ preventScroll: true }); }, 350);
}
startBtn.addEventListener('click', function () { show(0); });
document.addEventListener('keydown', function (e) {
if (index < 0) return;
if (e.key === 'Escape') return end();
if (e.key !== 'Tab' || !popover) return;
var tip = document.getElementById(current.getAttribute('aria-describedby'));
var btns = tip ? tip.querySelectorAll('button') : [];
if (!btns.length) return;
var first = btns[0], last = btns[btns.length - 1];
if (!tip.contains(document.activeElement)) { e.preventDefault(); (e.shiftKey ? last : first).focus(); }
else if (e.shiftKey && document.activeElement === first) { e.preventDefault(); last.focus(); }
else if (!e.shiftKey && document.activeElement === last) { e.preventDefault(); first.focus(); }
});
if (window.innerWidth >= 992 && !window.matchMedia('(prefers-reduced-motion: reduce)').matches) setTimeout(function () { show(0); }, 300);
}
function initGalleryLightbox() {
var modalEl = document.getElementById('shotModal');
var img = document.getElementById('shotImg');
if (!modalEl || !img) return;
var modal = bootstrap.Modal.getOrCreateInstance(modalEl);
document.querySelectorAll('.wdw-shot').forEach(function (b) {
b.addEventListener('click', function () { img.src = b.dataset.full; img.alt = b.dataset.alt; modal.show(); });
});
}
initTour();
initGalleryLightbox();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.