Skip to content

Commit 58e76d8

Browse files
committed
exclusive content
1 parent 1a65f0d commit 58e76d8

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

src/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<!-- Custom Styles -->
1111
<link href="./static/css/styles.css" rel="stylesheet" />
1212
</head>
13+
1314
<body>
1415
<section id="intro">
1516
<div id="intro-info">
@@ -56,6 +57,16 @@ <h2 class="bio">
5657
>
5758
<i class="link-icon fa-lg fa-solid fa-envelope"></i>
5859
</a>
60+
<a
61+
aria-label="Exclusive Content"
62+
class="link tippyme bounce2"
63+
target="_blank"
64+
href="./static/content/exclusive.jpeg"
65+
tooltip-text="Exclusive Content 👀"
66+
tooltip-type="exclusive"
67+
>
68+
<i class="link-icon fa-lg fa-solid fa-lock"></i>
69+
</a>
5970
</div>
6071
</div>
6172
</section>

src/static/content/exclusive.jpeg

31.1 KB
Loading

src/static/css/styles.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,23 @@ body {
8484
color: #eee;
8585
transition: 0.2s;
8686
}
87+
88+
.bounce2 {
89+
animation: bounce2 2s ease infinite;
90+
}
91+
92+
@keyframes bounce2 {
93+
0%,
94+
20%,
95+
50%,
96+
80%,
97+
100% {
98+
transform: translateY(0);
99+
}
100+
40% {
101+
transform: translateY(-30px);
102+
}
103+
60% {
104+
transform: translateY(-15px);
105+
}
106+
}

src/ts/index.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1-
import tippy from 'tippy.js';
1+
import tippy, { Props } from 'tippy.js';
2+
3+
const tooltipProfiles: Record<string, Partial<Props>> = {
4+
default: {},
5+
exclusive: {
6+
showOnCreate: true,
7+
placement: 'bottom',
8+
},
9+
};
210

311
const init = () => {
412
const elementsThatNeedTooltip = document.querySelectorAll('.tippyme');
513

614
elementsThatNeedTooltip.forEach((element) => {
715
const content = element.getAttribute('tooltip-text') ?? 'I forgot ¯_(ツ)_/¯';
8-
tippy(element, { content });
16+
const type = element.getAttribute('tooltip-type') ?? 'default';
17+
18+
tippy(element, { content, ...tooltipProfiles[type] });
919

1020
element.toggleAttribute('tooltip-text');
1121
element.classList.toggle('tippyme');

0 commit comments

Comments
 (0)