forked from AnujShrivastava01/AnimateItNow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopaque_hover.html
More file actions
885 lines (764 loc) · 26.7 KB
/
opaque_hover.html
File metadata and controls
885 lines (764 loc) · 26.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
c<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Opaque on Hover / Animate It Now</title>
<link rel="icon" href="favicon.png" type="image/x-icon" />
<meta name="description" content="A comprehensive collection of CSS animation templates and effects for web developers" />
<link rel="icon" type="image/png" href="images/logo.png" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* CSS Variables for Theming */
:root {
--primary: #6c63ff;
--primary-light: #8a84ff;
--primary-dark: #554fd8;
--secondary: #ff6584;
--accent: #36d1dc;
--text: #2a2a3c;
--text-light: #6c757d;
--bg: #ffffff;
--bg-secondary: #f8f9fa;
--bg-tertiary: #e9ecef;
--border: #dee2e6;
--shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
--radius: 12px;
--transition: all 0.3s ease;
}
/* Dark Mode Variables */
.dark-theme {
--primary: #8a84ff;
--primary-light: #a8a4ff;
--primary-dark: #6c63ff;
--secondary: #ff8fa3;
--accent: #4dd0e1;
--text: #f8f9fa;
--text-light: #a0a0a0;
--bg: #121212;
--bg-secondary: #1e1e1e;
--bg-tertiary: #2a2a2a;
--border: #404040;
--shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
/* Base Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', 'Segoe UI', sans-serif;
line-height: 1.6;
color: var(--text);
background-color: var(--bg);
transition: var(--transition);
min-height: 100vh;
display: flex;
flex-direction: column;
}
.container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
/* Header Styles */
.header {
background: linear-gradient(135deg, var(--primary), var(--accent));
color: white;
padding: 100px 0 60px;
text-align: center;
margin-bottom: 40px;
}
.header h1 {
font-size: 3rem;
margin-bottom: 15px;
}
.header p {
font-size: 1.2rem;
max-width: 700px;
margin: 0 auto;
opacity: 0.9;
}
/* Main Content */
.main-content {
flex: 1;
padding: 0 0 60px;
}
.section-title {
text-align: center;
margin-bottom: 40px;
}
.section-title h2 {
font-size: 2.2rem;
margin-bottom: 10px;
color: var(--primary);
}
.section-title p {
color: var(--text-light);
max-width: 700px;
margin: 0 auto;
}
/* Examples Section */
.examples-section {
margin-bottom: 60px;
}
.examples-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 30px;
margin-top: 40px;
}
.example-card {
background: var(--bg);
border-radius: var(--radius);
padding: 30px;
box-shadow: var(--shadow);
transition: var(--transition);
border: 1px solid var(--border);
text-align: center;
}
.example-card:hover {
transform: translateY(-5px);
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}
.example-title {
font-size: 1.5rem;
margin-bottom: 20px;
color: var(--primary);
}
.example-description {
color: var(--text-light);
margin-bottom: 20px;
}
/* Opaque Elements */
.opaque-container {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
gap: 20px;
margin-top: 20px;
}
.opq {
height: 60px;
width: 180px;
background-color: var(--primary);
font-size: 18px;
display: flex;
justify-content: center;
align-items: center;
color: white;
border-radius: var(--radius);
transition: var(--transition);
font-weight: 600;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
/* Different opacity effects */
.opq-basic:hover {
opacity: 0.7;
cursor: pointer;
}
.opq-slow:hover {
opacity: 0.7;
cursor: pointer;
transition: opacity 1s ease;
}
.opq-scale:hover {
opacity: 0.7;
cursor: pointer;
transform: scale(1.05);
}
.opq-color:hover {
opacity: 0.7;
cursor: pointer;
background-color: var(--secondary);
}
.opq-border:hover {
opacity: 0.7;
cursor: pointer;
border: 3px solid var(--accent);
}
.opq-glow:hover {
opacity: 0.7;
cursor: pointer;
box-shadow: 0 0 20px var(--primary);
}
/* Code Section */
.code-section {
background: var(--bg-secondary);
border-radius: var(--radius);
padding: 40px;
margin-top: 40px;
}
.code-tabs {
display: flex;
margin-bottom: 20px;
border-bottom: 1px solid var(--border);
}
.code-tab {
padding: 10px 20px;
background: none;
border: none;
cursor: pointer;
font-weight: 600;
color: var(--text-light);
transition: var(--transition);
border-bottom: 3px solid transparent;
}
.code-tab.active {
color: var(--primary);
border-bottom: 3px solid var(--primary);
}
.code-content {
background: var(--bg);
border-radius: var(--radius);
padding: 20px;
font-family: 'Courier New', monospace;
overflow-x: auto;
border: 1px solid var(--border);
}
.code-block {
display: none;
}
.code-block.active {
display: block;
}
/* Customization Section */
.customization-section {
margin-top: 60px;
}
.customization-controls {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin-top: 30px;
}
.control-group {
margin-bottom: 20px;
}
.control-label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: var(--text);
}
.control-input {
width: 100%;
padding: 10px;
border-radius: var(--radius);
border: 1px solid var(--border);
background: var(--bg);
color: var(--text);
transition: var(--transition);
}
.control-input:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}
.preview-box {
height: 100px;
width: 200px;
background-color: var(--primary);
margin: 30px auto;
display: flex;
justify-content: center;
align-items: center;
color: white;
font-weight: 600;
border-radius: var(--radius);
transition: var(--transition);
}
/* Footer */
.footer {
background-color: var(--bg-secondary);
color: var(--text);
padding: 40px 0 20px;
margin-top: 60px;
border-top: 1px solid var(--border);
}
.footer-content {
display: flex;
justify-content: space-between;
margin-bottom: 30px;
}
.footer-left h2 {
margin-bottom: 15px;
background: linear-gradient(to right, var(--primary), var(--accent));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.footer-right h4 {
margin-bottom: 15px;
}
.footer-right ul {
list-style: none;
}
.footer-right li {
margin-bottom: 8px;
}
.footer-right a {
color: var(--text-light);
transition: var(--transition);
}
.footer-right a:hover {
color: var(--primary);
}
.footer-bottom {
text-align: center;
padding-top: 20px;
border-top: 1px solid var(--border);
color: var(--text-light);
font-size: 0.9rem;
}
.footer-bottom .highlight {
color: var(--primary);
font-weight: 600;
}
/* Scroll to top button */
#scrollBtn {
display: none;
position: fixed;
bottom: 30px;
right: 30px;
z-index: 99;
border: none;
outline: none;
background-color: var(--primary);
color: white;
cursor: pointer;
padding: 15px;
border-radius: 50%;
font-size: 18px;
width: 50px;
height: 50px;
box-shadow: var(--shadow);
transition: var(--transition);
}
#scrollBtn:hover {
background-color: var(--primary-dark);
transform: translateY(-3px);
}
/* Theme Toggle */
.theme-toggle {
position: fixed;
top: 20px;
right: 20px;
background: var(--primary);
color: white;
border: none;
border-radius: 50%;
width: 50px;
height: 50px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.2rem;
box-shadow: var(--shadow);
z-index: 100;
transition: var(--transition);
}
.theme-toggle:hover {
transform: rotate(30deg);
}
/* Responsive Design */
@media (max-width: 768px) {
.header h1 {
font-size: 2.2rem;
}
.header p {
font-size: 1rem;
}
.examples-grid {
grid-template-columns: 1fr;
}
.footer-content {
flex-direction: column;
gap: 30px;
}
.opaque-container {
flex-direction: column;
}
}
</style>
</head>
<body>
<!-- Theme Toggle -->
<button class="theme-toggle" id="themeToggle">
<i class="fas fa-moon"></i>
</button>
<!-- Header -->
<header class="header">
<div class="container">
<h1>Opaque on Hover Effect</h1>
<p>Explore different variations of the opacity hover effect with smooth transitions and animations</p>
</div>
</header>
<!-- Main Content -->
<main class="main-content">
<div class="container">
<!-- Examples Section -->
<section class="examples-section">
<div class="section-title">
<h2>Opacity Hover Examples</h2>
<p>Hover over each element to see the different opacity effects in action</p>
</div>
<div class="examples-grid">
<!-- Basic Opacity -->
<div class="example-card">
<h3 class="example-title">Basic Opacity</h3>
<p class="example-description">Simple opacity change on hover</p>
<div class="opaque-container">
<div class="opq opq-basic">Hover Me</div>
</div>
</div>
<!-- Slow Transition -->
<div class="example-card">
<h3 class="example-title">Slow Transition</h3>
<p class="example-description">Opacity change with a slow, smooth transition</p>
<div class="opaque-container">
<div class="opq opq-slow">Slow Fade</div>
</div>
</div>
<!-- Scale Effect -->
<div class="example-card">
<h3 class="example-title">Scale + Opacity</h3>
<p class="example-description">Opacity change combined with scaling effect</p>
<div class="opaque-container">
<div class="opq opq-scale">Scale & Fade</div>
</div>
</div>
<!-- Color Change -->
<div class="example-card">
<h3 class="example-title">Color + Opacity</h3>
<p class="example-description">Opacity change with background color transition</p>
<div class="opaque-container">
<div class="opq opq-color">Color Shift</div>
</div>
</div>
<!-- Border Effect -->
<div class="example-card">
<h3 class="example-title">Border + Opacity</h3>
<p class="example-description">Opacity change with border animation</p>
<div class="opaque-container">
<div class="opq opq-border">Border Effect</div>
</div>
</div>
<!-- Glow Effect -->
<div class="example-card">
<h3 class="example-title">Glow + Opacity</h3>
<p class="example-description">Opacity change with glowing shadow effect</p>
<div class="opaque-container">
<div class="opq opq-glow">Glow Effect</div>
</div>
</div>
</div>
</section>
<!-- Code Section -->
<section class="code-section">
<div class="section-title">
<h2>Implementation Code</h2>
<p>Copy and customize these code snippets for your projects</p>
</div>
<div class="code-tabs">
<button class="code-tab active" data-tab="html">HTML</button>
<button class="code-tab" data-tab="css">CSS</button>
<button class="code-tab" data-tab="basic">Basic Example</button>
<button class="code-tab" data-tab="advanced">Advanced Example</button>
</div>
<div class="code-content">
<pre class="code-block active" id="html-code"><!-- Basic HTML Structure -->
<div class="opaque-element">
Hover over me!
</div>
<!-- With additional effects -->
<div class="opaque-element scale-on-hover">
Scale and opacity
</div>
<div class="opaque-element color-on-hover">
Color and opacity
</div></pre>
<pre class="code-block" id="css-code">/* Basic opacity on hover */
.opaque-element {
background-color: #6c63ff;
color: white;
padding: 15px 30px;
border-radius: 8px;
transition: opacity 0.3s ease;
}
.opaque-element:hover {
opacity: 0.7;
cursor: pointer;
}
/* With scale effect */
.scale-on-hover:hover {
opacity: 0.7;
transform: scale(1.05);
}
/* With color change */
.color-on-hover:hover {
opacity: 0.7;
background-color: #ff6584;
}</pre>
<pre class="code-block" id="basic-code"><!DOCTYPE html>
<html>
<head>
<style>
.opaque-box {
width: 200px;
height: 60px;
background: #6c63ff;
color: white;
display: flex;
align-items: center;
justify-content: center;
border-radius: 8px;
transition: opacity 0.3s ease;
}
.opaque-box:hover {
opacity: 0.7;
cursor: pointer;
}
</style>
</head>
<body>
<div class="opaque-box">Hover over me!</div>
</body>
</html></pre>
<pre class="code-block" id="advanced-code"><!DOCTYPE html>
<html>
<head>
<style>
.fancy-opaque {
width: 200px;
height: 60px;
background: linear-gradient(45deg, #6c63ff, #36d1dc);
color: white;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12px;
font-weight: bold;
box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.fancy-opaque:hover {
opacity: 0.8;
transform: translateY(-5px) scale(1.05);
box-shadow: 0 10px 25px rgba(108, 99, 255, 0.5);
cursor: pointer;
}
</style>
</head>
<body>
<div class="fancy-opaque">Fancy Hover Effect</div>
</body>
</html></pre>
</div>
</section>
<!-- Customization Section -->
<section class="customization-section">
<div class="section-title">
<h2>Customize Your Effect</h2>
<p>Adjust the parameters to create your perfect opacity hover effect</p>
</div>
<div class="customization-controls">
<div class="control-group">
<label class="control-label">Opacity Level (0.1 - 1.0)</label>
<input type="range" id="opacityRange" class="control-input" min="0.1" max="1.0" step="0.1" value="0.7">
<span id="opacityValue">0.7</span>
</div>
<div class="control-group">
<label class="control-label">Transition Duration (seconds)</label>
<input type="range" id="durationRange" class="control-input" min="0.1" max="2.0" step="0.1" value="0.3">
<span id="durationValue">0.3s</span>
</div>
<div class="control-group">
<label class="control-label">Background Color</label>
<input type="color" id="colorPicker" class="control-input" value="#6c63ff">
</div>
<div class="control-group">
<label class="control-label">Enable Scale Effect</label>
<input type="checkbox" id="scaleCheckbox" class="control-input">
</div>
</div>
<div class="preview-box" id="previewElement">
Preview Element
</div>
<div class="code-content">
<pre id="customCssCode">.custom-opaque {
background-color: #6c63ff;
color: white;
padding: 15px 30px;
border-radius: 8px;
transition: opacity 0.3s ease;
}
.custom-opaque:hover {
opacity: 0.7;
cursor: pointer;
}</pre>
</div>
</section>
</div>
</main>
<!-- Footer -->
<footer class="footer">
<div class="container">
<div class="footer-content">
<div class="footer-left">
<h2>AnimateItNow</h2>
<p>Creating impactful web animations and templates for everyone.</p>
</div>
<div class="footer-right">
<h4>Connect With Us</h4>
<ul>
<li><a href="https://github.com/itsAnimation/AnimateItNow" target="_blank"><i class="fab fa-github"></i> GitHub</a></li>
<li><a href="https://www.linkedin.com/in/anujshrivastava1/" target="_blank"><i class="fab fa-linkedin"></i> LinkedIn</a></li>
<li><a href="mailto:contact@animateitnow.com"><i class="fas fa-envelope"></i> Email Us</a></li>
</ul>
</div>
</div>
<div class="footer-bottom">
<p>© 2025 AnimateItNow. Made with ❤️ by <span class="highlight">Anuj</span> and Contributors.</p>
</div>
</div>
</footer>
<button onclick="scrollToTop()" id="scrollBtn" title="Go to top">↑</button>
<script>
// Theme Toggle
const themeToggle = document.getElementById('themeToggle');
const body = document.body;
function setTheme(isDark) {
const icon = themeToggle.querySelector('i');
body.classList.toggle('dark-theme', isDark);
localStorage.setItem('theme', isDark ? 'dark' : 'light');
if (icon) {
icon.className = isDark ? 'fas fa-sun' : 'fas fa-moon';
}
}
const savedTheme = localStorage.getItem('theme');
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
setTheme(savedTheme === 'dark' || (savedTheme === null && prefersDark));
themeToggle.addEventListener('click', () => {
setTheme(!body.classList.contains('dark-theme'));
});
// Code Tabs
const codeTabs = document.querySelectorAll('.code-tab');
const codeBlocks = document.querySelectorAll('.code-block');
codeTabs.forEach(tab => {
tab.addEventListener('click', () => {
const tabId = tab.getAttribute('data-tab');
// Update active tab
codeTabs.forEach(t => t.classList.remove('active'));
tab.classList.add('active');
// Show corresponding code block
codeBlocks.forEach(block => {
block.classList.remove('active');
if (block.id === `${tabId}-code`) {
block.classList.add('active');
}
});
});
});
// Customization Controls
const opacityRange = document.getElementById('opacityRange');
const opacityValue = document.getElementById('opacityValue');
const durationRange = document.getElementById('durationRange');
const durationValue = document.getElementById('durationValue');
const colorPicker = document.getElementById('colorPicker');
const scaleCheckbox = document.getElementById('scaleCheckbox');
const previewElement = document.getElementById('previewElement');
const customCssCode = document.getElementById('customCssCode');
function updatePreview() {
const opacity = opacityRange.value;
const duration = durationRange.value;
const color = colorPicker.value;
const scaleEnabled = scaleCheckbox.checked;
// Update preview element
previewElement.style.backgroundColor = color;
previewElement.style.transition = `all ${duration}s ease`;
// Update CSS code
let cssCode = `.custom-opaque {
background-color: ${color};
color: white;
padding: 15px 30px;
border-radius: 8px;
transition: opacity ${duration}s ease`;
if (scaleEnabled) {
cssCode += `, transform ${duration}s ease`;
}
cssCode += `;
}
.custom-opaque:hover {
opacity: ${opacity};
cursor: pointer;`;
if (scaleEnabled) {
cssCode += `
transform: scale(1.05);`;
}
cssCode += `
}`;
customCssCode.textContent = cssCode;
}
function setupHoverEffect() {
const opacity = opacityRange.value;
const duration = durationRange.value;
const color = colorPicker.value;
const scaleEnabled = scaleCheckbox.checked;
// Remove existing hover effect
previewElement.onmouseenter = null;
previewElement.onmouseleave = null;
// Add new hover effect
previewElement.onmouseenter = function() {
this.style.opacity = opacity;
if (scaleEnabled) {
this.style.transform = 'scale(1.05)';
}
};
previewElement.onmouseleave = function() {
this.style.opacity = '1';
if (scaleEnabled) {
this.style.transform = 'scale(1)';
}
};
}
// Event listeners for controls
opacityRange.addEventListener('input', function() {
opacityValue.textContent = this.value;
updatePreview();
setupHoverEffect();
});
durationRange.addEventListener('input', function() {
durationValue.textContent = `${this.value}s`;
updatePreview();
setupHoverEffect();
});
colorPicker.addEventListener('input', function() {
updatePreview();
setupHoverEffect();
});
scaleCheckbox.addEventListener('change', function() {
updatePreview();
setupHoverEffect();
});
// Initialize
updatePreview();
setupHoverEffect();
// Scroll to Top Button
function scrollToTop() {
window.scrollTo({ top: 0, behavior: 'smooth' });
}
window.onscroll = function() {
const scrollBtn = document.getElementById("scrollBtn");
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) {
scrollBtn.style.display = "block";
} else {
scrollBtn.style.display = "none";
}
};
</script>
</body>
</html>