Build a pagination pattern: series discovery and UX.
- User
Build a pagination pattern: series discovery and UX.
Assistant
Build a pagination pattern: series discovery and UX.
The user wants me to design a pagination pattern with a specific theme: "Series Discovery and UX." This suggests a webpage where users can browse through TV series or movie series with a focus on good user experience.
Let me think about what makes a compelling pagination design:
For the dynamic/interactive elements (at least 3 required):
Design approach:
Let me create a sophisticated series discovery interface with:
Color scheme:
I'll create a series discovery page with 12 sample series, showing 6 per page, with smooth pagination animations.
I'll create a sophisticated series discovery interface with smooth pagination, dynamic animations, and rich interactions.
Design Approach:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Series Discovery</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', system-ui, sans-serif;
background: #08080c;
color: #f0f0f0;
min-height: 100vh;
overflow-x: hidden;
}
/* Dynamic Background */
.bg-canvas {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
}
.gradient-orb {
position: absolute;
border-radius: 50%;
filter: blur(80px);
opacity: 0.4;
animation: orbFloat 20s ease-in-out infinite;
}
.orb-1 {
width: 600px;
height: 600px;
background: radial-gradient(circle, #d4a04a 0%, transparent 70%);
top: -200px;
right: -100px;
animation-delay: 0s;
}
.orb-2 {
width: 500px;
height: 500px;
background: radial-gradient(circle, #2a6b6b 0%, transparent 70%);
bottom: -150px;
left: -100px;
animation-delay: -7s;
}
.orb-3 {
width: 400px;
height: 400px;
background: radial-gradient(circle, #8b4513 0%, transparent 70%);
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
animation-delay: -14s;
}
@keyframes orbFloat {
0%, 100% { transform: translate(0, 0) scale(1); }
25% { transform: translate(50px, -30px) scale(1.1); }
50% { transform: translate(-30px, 50px) scale(0.95); }
75% { transform: translate(40px, 20px) scale(1.05); }
}
/* Particle System */
.particle {
position: absolute;
width: 3px;
height: 3px;
background: #d4a04a;
border-radius: 50%;
opacity: 0;
animation: particleRise 8s ease-in-out infinite;
}
@keyframes particleRise {
0% { opacity: 0; transform: translateY(0) scale(0); }
10% { opacity: 0.8; }
90% { opacity: 0.3; }
100% { opacity: 0; transform: translateY(-100vh) scale(1); }
}
/* Main Container */
.container {
position: relative;
z-index: 1;
max-width: 1400px;
margin: 0 auto;
padding: 40px 20px;
}
/* Header */
.header {
text-align: center;
margin-bottom: 60px;
}
.header h1 {
font-size: 3rem;
font-weight: 700;
background: linear-gradient(135deg, #f5d79e 0%, #d4a04a 50%, #a67c32 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 10px;
letter-spacing: -1px;
}
.header p {
color: #8a8a9a;
font-size: 1.1rem;
}
/* Filters */
.filters {
display: flex;
justify-content: center;
gap: 15px;
margin-bottom: 40px;
flex-wrap: wrap;
}
.filter-btn {
padding: 10px 24px;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 30px;
color: #b0b0c0;
font-size: 0.9rem;
cursor: pointer;
transition: all 0.3s ease;
}
.filter-btn:hover {
background: rgba(212, 160, 74, 0.1);
border-color: rgba(212, 160, 74, 0.3);
color: #d4a04a;
}
.filter-btn.active {
background: linear-gradient(135deg, #d4a04a 0%, #a67c32 100%);
border-color: transparent;
color: #0a0a0f;
font-weight: 600;
}
/* Series Grid */
.series-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 30px;
margin-bottom: 60px;
min-height: 600px;
}
.series-card {
position: relative;
background: linear-gradient(145deg, rgba(20, 20, 30, 0.9) 0%, rgba(15, 15, 22, 0.95) 100%);
border-radius: 16px;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.06);
cursor: pointer;
transform-style: preserve-3d;
perspective: 1000px;
transition: transform 0.4s ease, box-shadow 0.4s ease;
opacity: 0;
transform: translateY(40px);
}
.series-card.visible {
opacity: 1;
transform: translateY(0);
}
.series-card:hover {
transform: translateY(-10px) rotateX(5deg);
box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(212, 160, 74, 0.1);
}
.card-poster {
position: relative;
height: 200px;
overflow: hidden;
}
.card-poster img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.5s ease;
}
.series-card:hover .card-poster img {
transform: scale(1.1);
}
.poster-overlay {
position: absolute;
inset: 0;
background: linear-gradient(to top, rgba(8, 8, 12, 1) 0%, transparent 60%);
}
.card-rating {
position: absolute;
top: 12px;
right: 12px;
background: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(10px);
padding: 6px 12px;
border-radius: 20px;
display: flex;
align-items: center;
gap: 5px;
font-size: 0.85rem;
font-weight: 600;
}
.card-rating svg {
width: 14px;
height: 14px;
fill: #d4a04a;
}
.card-content {
padding: 20px;
}
.card-title {
font-size: 1.2rem;
font-weight: 600;
margin-bottom: 8px;
color: #f0f0f0;
}
.card-meta {
display: flex;
gap: 15px;
color: #7a7a8a;
font-size: 0.85rem;
margin-bottom: 12px;
}
.card-genres {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.genre-tag {
padding: 4px 10px;
background: rgba(212, 160, 74, 0.1);
border: 1px solid rgba(212, 160, 74, 0.2);
border-radius: 12px;
font-size: 0.75rem;
color: #d4a04a;
}
.card-progress {
margin-top: 15px;
height: 3px;
background: rgba(255, 255, 255, 0.1);
border-radius: 2px;
overflow: hidden;
}
.progress-bar {
height: 100%;
background: linear-gradient(90deg, #d4a04a 0%, #f5d79e 100%);
border-radius: 2px;
transition: width 0.5s ease;
}
.card-hover-effect {
position: absolute;
inset: 0;
background: linear-gradient(135deg, transparent 0%, rgba(212, 160, 74, 0.05) 100%);
opacity: 0;
transition: opacity 0.3s ease;
pointer-events: none;
}
.series-card:hover .card-hover-effect {
opacity: 1;
}
/* Pagination */
.pagination-container {
display: flex;
flex-direction: column;
align-items: center;
gap: 25px;
}
.pagination-progress {
width: 100%;
max-width: 400px;
height: 4px;
background: rgba(255, 255, 255, 0.1);
border-radius: 2px;
overflow: hidden;
}
.pagination-progress-bar {
height: 100%;
background: linear-gradient(90deg, #d4a04a 0%, #f5d79e 100%);
border-radius: 2px;
transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.pagination {
display: flex;
align-items: center;
gap: 8px;
}
.page-btn {
width: 48px;
height: 48px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 12px;
color: #9a9aaa;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.page-btn::before {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(135deg, #d4a04a 0%, #a67c32 100%);
opacity: 0;
transition: opacity 0.3s ease;
}
.page-btn span {
position: relative;
z-index: 1;
}
.page-btn:hover:not(.active):not(.disabled) {
border-color: rgba(212, 160, 74, 0.3);
color: #d4a04a;
transform: translateY(-2px);
}
.page-btn.active {
border-color: transparent;
color: #0a0a0f;
font-weight: 600;
}
.page-btn.active::before {
opacity: 1;
}
.page-btn.disabled {
opacity: 0.3;
cursor: not-allowed;
}
.page-btn.nav-btn {
width: 56px;
}
.page-btn.nav-btn svg {
width: 20px;
height: 20px;
position: relative;
z-index: 1;
}
.page-ellipsis {
color: #6a6a7a;
padding: 0 5px;
}
.page-info {
color: #7a7a8a;
font-size: 0.9rem;
margin-top: 10px;
}
.page-info span {
color: #d4a04a;
font-weight: 600;
}
/* Items per page selector */
.items-selector {
display: flex;
align-items: center;
gap: 15px;
margin-top: 20px;
}
.items-selector label {
color: #7a7a8a;
font-size: 0.9rem;
}
.items-options {
display: flex;
gap: 8px;
}
.items-option {
padding: 8px 16px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 8px;
color: #9a9aaa;
font-size: 0.85rem;
cursor: pointer;
transition: all 0.3s ease;
}
.items-option:hover {
border-color: rgba(212, 160, 74, 0.3);
color: #d4a04a;
}
.items-option.active {
background: rgba(212, 160, 74, 0.15);
border-color: #d4a04a;
color: #d4a04a;
}
/* Loading Animation */
.loading-skeleton {
background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
background-size: 200% 100%;
animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
/* Responsive */
@media (max-width: 768px) {
.header h1 {
font-size: 2rem;
}
.series-grid {
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 20px;
}
.page-btn {
width: 40px;
height: 40px;
font-size: 0.9rem;
}
.page-btn.nav-btn {
width: 44px;
}
}
</style>
</head>
<body>
<div class="bg-canvas">
<div class="gradient-orb orb-1"></div>
<div class="gradient-orb orb-2"></div>
<div class="gradient-orb orb-3"></div>
</div>
<div class="container">
<header class="header">
<h1>Discover Series</h1>
<p>Explore our curated collection of award-winning series</p>
</header>
<div class="filters">
<button class="filter-btn active" data-filter="all">All</button>
<button class="filter-btn" data-filter="drama">Drama</button>
<button class="filter-btn" data-filter="scifi">Sci-Fi</button>
<button class="filter-btn" data-filter="thriller">Thriller</button>
<button class="filter-btn" data-filter="fantasy">Fantasy</button>
<button class="filter-btn" data-filter="crime">Crime</button>
</div>
<div class="series-grid" id="seriesGrid"></div>
<div class="pagination-container">
<div class="pagination-progress">
<div class="pagination-progress-bar" id="progressBar"></div>
</div>
<div class="pagination" id="pagination"></div>
<div class="page-info" id="pageInfo"></div>
<div class="items-selector">
<label>Items per page:</label>
<div class="items-options">
<button class="items-option" data-items="4">4</button>
<button class="items-option active" data-items="6">6</button>
<button class="items-option" data-items="9">9</button>
</div>
</div>
</div>
</div>
<script>
// Series Data
const seriesData = [
{ id: 1, title: "Breaking Barriers", year: 2023, seasons: 4, rating: 9.2, genres: ["Drama", "Crime"], progress: 85, image: "https://picsum.photos/seed/s1/400/300" },
{ id: 2, title: "Stellar Odyssey", year: 2024, seasons: 2, rating: 8.8, genres: ["Sci-Fi", "Drama"], progress: 45, image: "https://picsum.photos/seed/s2/400/300" },
{ id: 3, title: "The Last Kingdom", year: 2022, seasons: 5, rating: 9.0, genres: ["Fantasy", "Drama"], progress: 100, image: "https://picsum.photos/seed/s3/400/300" },
{ id: 4, title: "Midnight Protocol", year: 2023, seasons: 3, rating: 8.5, genres: ["Thriller", "Crime"], progress: 30, image: "https://picsum.photos/seed/s4/400/300" },
{ id: 5, title: "Echoes of Time", year: 2024, seasons: 1, rating: 8.9, genres: ["Sci-Fi", "Fantasy"], progress: 15, image: "https://picsum.photos/seed/s5/400/300" },
{ id: 6, title: "The Crown Files", year: 2021, seasons: 6, rating: 9.1, genres: ["Drama", "Thriller"], progress: 70, image: "https://picsum.photos/seed/s6/400/300" },
{ id: 7, title: "Neon Shadows", year: 2023, seasons: 2, rating: 8.7, genres: ["Sci-Fi", "Crime"], progress: 55, image: "https://picsum.photos/seed/s7/400/300" },
{ id: 8, title: "Ancient Realm", year: 2022, seasons: 4, rating: 8.6, genres: ["Fantasy", "Drama"], progress: 90, image: "https://picsum.photos/seed/s8/400/300" },
{ id: 9, title: "The Deep Web", year: 2024, seasons: 1, rating: 8.4, genres: ["Thriller", "Crime"], progress: 20, image: "https://picsum.photos/seed/s9/400/300" },
{ id: 10, title: "Quantum Break", year: 2023, seasons: 3, rating: 9.3, genres: ["Sci-Fi", "Drama"], progress: 65, image: "https://picsum.photos/seed/s10/400/300" },
{ id: 11, title: "Shadow Hunters", year: 2022, seasons: 5, rating: 8.2, genres: ["Fantasy", "Thriller"], progress: 40, image: "https://picsum.photos/seed/s11/400/300" },
{ id: 12, title: "City of Secrets", year: 2024, seasons: 2, rating: 8.8, genres: ["Crime", "Drama"], progress: 10, image: "https://picsum.photos/seed/s12/400/300" },
{ id: 13, title: "Beyond Horizon", year: 2023, seasons: 3, rating: 9.0, genres: ["Sci-Fi", "Fantasy"], progress: 75, image: "https://picsum.photos/seed/s13/400/300" },
{ id: 14, title: "The inheritance", year: 2021, seasons: 4, rating: 8.9, genres: ["Drama", "Thriller"], progress: 100, image: "https://picsum.photos/seed/s14/400/300" },
{ id: 15, title: "Dark Waters", year: 2024, seasons: 1, rating: 8.5, genres: ["Crime", "Thriller"], progress: 25, image: "https://picsum.photos/seed/s15/400/300" },
{ id: 16, title: "Mythic Tales", year: 2022, seasons: 3, rating: 8.7, genres: ["Fantasy", "Drama"], progress: 60, image: "https://picsum.photos/seed/s16/400/300" },
{ id: 17, title: "Binary Code", year: 2023, seasons: 2, rating: 8.6, genres: ["Sci-Fi", "Thriller"], progress: 35, image: "https://picsum.photos/seed/s17/400/300" },
{ id: 18, title: "The Syndicate", year: 2024, seasons: 1, rating: 9.1, genres: ["Crime", "Drama"], progress: 5, image: "https://picsum.photos/seed/s18/400/300" }
];
// State
let currentPage = 1;
let itemsPerPage = 6;
let currentFilter = 'all';
let filteredData = [...seriesData];
// DOM Elements
const seriesGrid = document.getElementById('seriesGrid');
const pagination = document.getElementById('pagination');
const progressBar = document.getElementById('progressBar');
const pageInfo = document.getElementById('pageInfo');
// Create particles
function createParticles() {
const canvas = document.querySelector('.bg-canvas');
for (let i = 0; i < 30; i++) {
const particle = document.createElement('div');
particle.className = 'particle';
particle.style.left = Math.random() * 100 + '%';
particle.style.bottom = '-10px';
particle.style.animationDelay = Math.random() * 8 + 's';
particle.style.animationDuration = (6 + Math.random() * 4) + 's';
canvas.appendChild(particle);
}
}
// Render Series Cards
function renderSeries() {
const start = (currentPage - 1) * itemsPerPage;
const end = start + itemsPerPage;
const pageSeries = filteredData.slice(start, end);
seriesGrid.innerHTML = '';
pageSeries.forEach((series, index) => {
const card = document.createElement('div');
card.className = 'series-card';
card.innerHTML = `
<div class="card-poster">
<img src="${series.image}" alt="${series.title}" loading="lazy">
<div class="poster-overlay"></div>
<div class="card-rating">
<svg viewBox="0 0 24 24"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
${series.rating}
</div>
</div>
<div class="card-content">
<h3 class="card-title">${series.title}</h3>
<div class="card-meta">
<span>${series.year}</span>
<span>${series.seasons} Season${series.seasons > 1 ? 's' : ''}</span>
</div>
<div class="card-genres">
${series.genres.map(g => `<span class="genre-tag">${g}</span>`).join('')}
</div>
<div class="card-progress">
<div class="progress-bar" style="width: ${series.progress}%"></div>
</div>
</div>
<div class="card-hover-effect"></div>
`;
seriesGrid.appendChild(card);
// Staggered animation
setTimeout(() => {
card.classList.add('visible');
}, index * 100);
});
}
// Render Pagination
function renderPagination() {
const totalPages = Math.ceil(filteredData.length / itemsPerPage);
let paginationHTML = '';
// Previous button
paginationHTML += `
<button class="page-btn nav-btn ${currentPage === 1 ? 'disabled' : ''}" data-action="prev">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M15 18l-6-6 6-6"/>
</svg>
</button>
`;
// Page numbers
const maxVisiblePages = 5;
let startPage = Math.max(1, currentPage - Math.floor(maxVisiblePages / 2));
let endPage = Math.min(totalPages, startPage + maxVisiblePages - 1);
if (endPage - startPage + 1 < maxVisiblePages) {
startPage = Math.max(1, endPage - maxVisiblePages + 1);
}
if (startPage > 1) {
paginationHTML += `<button class="page-btn" data-page="1"><span>1</span></button>`;
if (startPage > 2) {
paginationHTML += `<span class="page-ellipsis">...</span>`;
}
}
for (let i = startPage; i <= endPage; i++) {
paginationHTML += `
<button class="page-btn ${i === currentPage ? 'active' : ''}" data-page="${i}">
<span>${i}</span>
</button>
`;
}
if (endPage < totalPages) {
if (endPage < totalPages - 1) {
paginationHTML += `<span class="page-ellipsis">...</span>`;
}
paginationHTML += `<button class="page-btn" data-page="${totalPages}"><span>${totalPages}</span></button>`;
}
// Next button
paginationHTML += `
<button class="page-btn nav-btn ${currentPage === totalPages ? 'disabled' : ''}" data-action="next">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M9 18l6-6-6-6"/>
</svg>
</button>
`;
pagination.innerHTML = paginationHTML;
// Update progress bar
const progress = (currentPage / totalPages) * 100;
progressBar.style.width = progress + '%';
// Update page info
const start = (currentPage - 1) * itemsPerPage + 1;
const end = Math.min(currentPage * itemsPerPage, filteredData.length);
pageInfo.innerHTML = `Showing <span>${start}-${end}</span> of <span>${filteredData.length}</span> series`;
// Add event listeners
pagination.querySelectorAll('.page-btn').forEach(btn => {
btn.addEventListener('click', handlePageClick);
});
}
// Handle Page Click
function handlePageClick(e) {
const btn = e.currentTarget;
const page = btn.dataset.page;
const action = btn.dataset.action;
if (btn.classList.contains('disabled')) return;
if (action === 'prev') {
currentPage = Math.max(1, currentPage - 1);
} else if (action === 'next') {
currentPage = Math.min(Math.ceil(filteredData.length / itemsPerPage), currentPage + 1);
} else if (page) {
currentPage = parseInt(page);
}
renderSeries();
renderPagination();
}
// Handle Filter Click
function handleFilterClick(e) {
const filter = e.target.dataset.filter;
if (!filter) return;
document.querySelectorAll('.filter-btn').forEach(btn => btn.classList.remove('active'));
e.target.classList.add('active');
currentFilter = filter;
currentPage = 1;
if (filter === 'all') {
filteredData = [...seriesData];
} else {
filteredData = seriesData.filter(series =>
series.genres.some(g => g.toLowerCase() === filter.toLowerCase())
);
}
renderSeries();
renderPagination();
}
// Handle Items Per Page
function handleItemsChange(e) {
const items = e.target.dataset.items;
if (!items) return;
document.querySelectorAll('.items-option').forEach(btn => btn.classList.remove('active'));
e.target.classList.add('active');
itemsPerPage = parseInt(items);
currentPage = 1;
renderSeries();
renderPagination();
}
// Initialize
function init() {
createParticles();
renderSeries();
renderPagination();
// Event listeners
document.querySelectorAll('.filter-btn').forEach(btn => {
btn.addEventListener('click', handleFilterClick);
});
document.querySelectorAll('.items-option').forEach(btn => {
btn.addEventListener('click', handleItemsChange);
});
// Keyboard navigation
document.addEventListener('keydown', (e) => {
if (e.key === 'ArrowLeft') {
currentPage = Math.max(1, currentPage - 1);
renderSeries();
renderPagination();
} else if (e.key === 'ArrowRight') {
currentPage = Math.min(Math.ceil(filteredData.length / itemsPerPage), currentPage + 1);
renderSeries();
renderPagination();
}
});
}
init();
</script>
</body>
</html>
Visual Progress Indicator - Top progress bar shows current position in the collection
Smart Page Numbers - Ellipsis for large page counts, always showing first and last pages
Staggered Card Animations - Cards animate in sequence when changing pages for smooth transitions
Multiple Items Per Page Options - User can customize viewing density (4/6/9 items)
Keyboard Navigation - Arrow keys for prev/next page
Filter Integration - Pagination updates dynamically when filters change