<script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>
<div class="container">
<div class="header">
<h1>Loading Spinners</h1>
<p class="subtitle">Professional loading animations for modern web applications</p>
</div>
<div class="grid">
<div class="card">
<div class="spinner-container">
<div class="spinner-1"></div>
</div>
<h3 class="card-title">Classic Circle</h3>
<p class="card-description">Simple and elegant rotating border</p>
</div>
<div class="card">
<div class="spinner-container">
<div class="spinner-2"></div>
</div>
<h3 class="card-title">Dual Ring</h3>
<p class="card-description">Two-tone spinning ring effect</p>
</div>
<div class="card">
<div class="spinner-container">
<div class="spinner-3">
<span></span>
<span></span>
<span></span>
</div>
</div>
<h3 class="card-title">Bouncing Dots</h3>
<p class="card-description">Three dots with wave animation</p>
</div>
<div class="card">
<div class="spinner-container">
<div class="spinner-4"></div>
</div>
<h3 class="card-title">Pulse</h3>
<p class="card-description">Smooth pulsing circle effect</p>
</div>
<div class="card">
<div class="spinner-container">
<div class="spinner-5">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<h3 class="card-title">Bars</h3>
<p class="card-description">Vertical bars with wave motion</p>
</div>
<div class="card">
<div class="spinner-container">
<div class="spinner-6"></div>
</div>
<h3 class="card-title">Ring Pulse</h3>
<p class="card-description">Expanding and contracting ring</p>
</div>
<div class="card">
<div class="spinner-container">
<div class="spinner-7">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<h3 class="card-title">Grid</h3>
<p class="card-description">3x3 grid with sequential fade</p>
</div>
<div class="card">
<div class="spinner-container">
<div class="spinner-8">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<h3 class="card-title">Circle Dots</h3>
<p class="card-description">Dots arranged in circular pattern</p>
</div>
<div class="card">
<div class="spinner-container">
<div class="spinner-9"></div>
</div>
<h3 class="card-title">Gradient Ring</h3>
<p class="card-description">Colorful gradient border spinner</p>
</div>
</div>
<div class="demo-section">
<h2 class="demo-title">Interactive Demo</h2>
<div class="demo-buttons">
<button class="btn btn-primary" id="showInlineBtn">
<ion-icon name="refresh-outline"></ion-icon>
Show Inline Loader
</button>
<button class="btn btn-primary" id="showOverlayBtn">
<ion-icon name="hourglass-outline"></ion-icon>
Show Full Page Overlay
</button>
<button class="btn btn-secondary" id="clearBtn">
<ion-icon name="close-outline"></ion-icon>
Clear
</button>
</div>
<div class="demo-display" id="demoDisplay">
<p style="color: #94a3b8;">Click a button to see the loader in action</p>
</div>
</div>
</div>
<div class="overlay" id="overlay">
<div class="overlay-content">
<div class="spinner-1" style="margin: 0 auto;"></div>
<p class="overlay-text">Loading, please wait...</p>
</div>
</div>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
background: linear-gradient(135deg, #00008B 0%, #764ba2 100%);
min-height: 100vh;
padding: 40px 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
.header {
text-align: center;
margin-bottom: 50px;
color: white;
}
h1 {
font-size: 42px;
margin-bottom: 12px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}
.subtitle {
font-size: 18px;
opacity: 0.9;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 24px;
margin-bottom: 30px;
}
.card {
background: white;
border-radius: 16px;
padding: 40px;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
display: flex;
flex-direction: column;
align-items: center;
transition: transform 0.3s;
}
.card:hover {
transform: translateY(-5px);
}
.spinner-container {
width: 120px;
height: 120px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 24px;
}
.card-title {
font-size: 18px;
font-weight: 600;
color: #00008B;
margin-bottom: 8px;
}
.card-description {
font-size: 14px;
color: #64748b;
text-align: center;
}
/* Spinner 1: Classic Circle */
.spinner-1 {
width: 60px;
height: 60px;
border: 6px solid #00008B;
border-top-color: #667eea;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
/* Spinner 2: Dual Ring */
.spinner-2 {
width: 60px;
height: 60px;
border: 6px solid transparent;
border-top-color: #667eea;
border-bottom-color: #00008B;
border-radius: 50%;
animation: spin 1s linear infinite;
}
/* Spinner 3: Dots */
.spinner-3 {
display: flex;
gap: 8px;
}
.spinner-3 span {
width: 12px;
height: 12px;
background: #00008B;
border-radius: 50%;
animation: bounce 1.4s infinite ease-in-out both;
}
.spinner-3 span:nth-child(1) {
animation-delay: -0.32s;
}
.spinner-3 span:nth-child(2) {
animation-delay: -0.16s;
}
/* Spinner 4: Pulse */
.spinner-4 {
width: 60px;
height: 60px;
background: #00008B;
border-radius: 50%;
animation: pulse 1.2s infinite ease-in-out;
}
/* Spinner 5: Bars */
.spinner-5 {
display: flex;
gap: 6px;
align-items: center;
height: 60px;
}
.spinner-5 span {
width: 8px;
height: 40px;
background: #00008B;
border-radius: 4px;
animation: bars 1.2s infinite ease-in-out;
}
.spinner-5 span:nth-child(1) {
animation-delay: -0.4s;
}
.spinner-5 span:nth-child(2) {
animation-delay: -0.3s;
}
.spinner-5 span:nth-child(3) {
animation-delay: -0.2s;
}
.spinner-5 span:nth-child(4) {
animation-delay: -0.1s;
}
/* Spinner 6: Ring */
.spinner-6 {
width: 60px;
height: 60px;
border: 6px solid #00008B;
border-radius: 50%;
animation: ring 1.5s infinite ease-in-out;
}
/* Spinner 7: Grid */
.spinner-7 {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 6px;
}
.spinner-7 span {
width: 12px;
height: 12px;
background: #00008B;
border-radius: 2px;
animation: grid 1.5s infinite ease-in-out;
}
.spinner-7 span:nth-child(1) { animation-delay: 0s; }
.spinner-7 span:nth-child(2) { animation-delay: 0.1s; }
.spinner-7 span:nth-child(3) { animation-delay: 0.2s; }
.spinner-7 span:nth-child(4) { animation-delay: 0.3s; }
.spinner-7 span:nth-child(5) { animation-delay: 0.4s; }
.spinner-7 span:nth-child(6) { animation-delay: 0.5s; }
.spinner-7 span:nth-child(7) { animation-delay: 0.6s; }
.spinner-7 span:nth-child(8) { animation-delay: 0.7s; }
.spinner-7 span:nth-child(9) { animation-delay: 0.8s; }
/* Spinner 8: Circle Dots */
.spinner-8 {
width: 60px;
height: 60px;
position: relative;
}
.spinner-8 span {
position: absolute;
width: 10px;
height: 10px;
background: #00008B;
border-radius: 50%;
animation: circleDots 1.2s infinite ease-in-out;
}
.spinner-8 span:nth-child(1) {
top: 0;
left: 50%;
transform: translateX(-50%);
animation-delay: 0s;
}
.spinner-8 span:nth-child(2) {
top: 14%;
right: 14%;
animation-delay: -0.1s;
}
.spinner-8 span:nth-child(3) {
top: 50%;
right: 0;
transform: translateY(-50%);
animation-delay: -0.2s;
}
.spinner-8 span:nth-child(4) {
bottom: 14%;
right: 14%;
animation-delay: -0.3s;
}
.spinner-8 span:nth-child(5) {
bottom: 0;
left: 50%;
transform: translateX(-50%);
animation-delay: -0.4s;
}
.spinner-8 span:nth-child(6) {
bottom: 14%;
left: 14%;
animation-delay: -0.5s;
}
.spinner-8 span:nth-child(7) {
top: 50%;
left: 0;
transform: translateY(-50%);
animation-delay: -0.6s;
}
.spinner-8 span:nth-child(8) {
top: 14%;
left: 14%;
animation-delay: -0.7s;
}
/* Spinner 9: Gradient Circle */
.spinner-9 {
width: 60px;
height: 60px;
border: 6px solid transparent;
border-radius: 50%;
background: linear-gradient(white, white) padding-box,
linear-gradient(45deg, #00008B, #764ba2) border-box;
position: relative;
animation: spin 1s linear infinite;
}
.spinner-9::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 8px;
height: 8px;
background: #00008B;
border-radius: 50%;
transform: translate(-50%, -50%);
}
/* Demo Section */
.demo-section {
background: white;
border-radius: 16px;
padding: 40px;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
text-align: center;
}
.demo-title {
font-size: 24px;
font-weight: 600;
color: #1a202c;
margin-bottom: 24px;
}
.demo-buttons {
display: flex;
gap: 12px;
justify-content: center;
flex-wrap: wrap;
margin-bottom: 30px;
}
.btn {
padding: 12px 24px;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
display: inline-flex;
align-items: center;
gap: 8px;
}
.btn-primary {
background: #667eea;
color: white;
}
.btn-primary:hover {
background: #5568d3;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
.btn-secondary {
background: #f1f5f9;
color: #00008B;
}
.btn-secondary:hover {
background: #e2e8f0;
}
.demo-display {
min-height: 200px;
background: #f8fafc;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.7);
display: none;
align-items: center;
justify-content: center;
z-index: 1000;
}
.overlay.active {
display: flex;
}
.overlay-content {
background: white;
padding: 40px;
border-radius: 16px;
text-align: center;
min-width: 300px;
}
.overlay-text {
margin-top: 20px;
color: #64748b;
font-size: 16px;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
@keyframes bounce {
0%, 80%, 100% {
transform: scale(0);
opacity: 0.5;
}
40% {
transform: scale(1);
opacity: 1;
}
}
@keyframes pulse {
0%, 100% {
transform: scale(0.8);
opacity: 0.5;
}
50% {
transform: scale(1.2);
opacity: 1;
}
}
@keyframes bars {
0%, 40%, 100% {
transform: scaleY(0.5);
}
20% {
transform: scaleY(1);
}
}
@keyframes ring {
0%, 100% {
transform: scale(0.8);
opacity: 0.5;
}
50% {
transform: scale(1);
opacity: 1;
}
}
@keyframes grid {
0%, 70%, 100% {
transform: scale(1);
opacity: 1;
}
35% {
transform: scale(0);
opacity: 0.3;
}
}
@keyframes circleDots {
0%, 80%, 100% {
transform: scale(0);
opacity: 0.3;
}
40% {
transform: scale(1);
opacity: 1;
}
}
@media (max-width: 768px) {
h1 {
font-size: 32px;
}
.grid {
grid-template-columns: 1fr;
}
}
const showInlineBtn = document.getElementById('showInlineBtn');
const showOverlayBtn = document.getElementById('showOverlayBtn');
const clearBtn = document.getElementById('clearBtn');
const demoDisplay = document.getElementById('demoDisplay');
const overlay = document.getElementById('overlay');
showInlineBtn.addEventListener('click', () => {
demoDisplay.innerHTML = `
<div>
<div class="spinner-2" style="margin: 0 auto 20px;"></div>
<p style="color: #64748b;">Loading content...</p>
</div>
`;
// Simulate loading completion
setTimeout(() => {
demoDisplay.innerHTML = `
<div style="color: #10b981; display: flex; flex-direction: column; align-items: center; gap: 12px;">
<ion-icon name="checkmark-circle" style="font-size: 48px;"></ion-icon>
<p style="font-weight: 600;">Content loaded successfully!</p>
</div>
`;
}, 3000);
});
showOverlayBtn.addEventListener('click', () => {
overlay.classList.add('active');
// Simulate loading completion
setTimeout(() => {
overlay.classList.remove('active');
}, 3000);
});
clearBtn.addEventListener('click', () => {
demoDisplay.innerHTML = '<p style="color: #94a3b8;">Click a button to see the loader in action</p>';
});
// Close overlay on click
overlay.addEventListener('click', (e) => {
if (e.target === overlay) {
overlay.classList.remove('active');
}
});
No comments yet. Be the first!