Skip to content

Commit b0ccdd6

Browse files
committed
add scroll sections
1 parent ad68600 commit b0ccdd6

2 files changed

Lines changed: 157 additions & 0 deletions

File tree

index.html

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,12 +744,73 @@ <h2 class="uk-heading-small uk-text-center">
744744
</div>
745745
</section>
746746

747+
<!-- Scroll indicator -->
748+
<nav class="scroll-indicator" aria-label="Navigation sections">
749+
<a href="#hello" class="scroll-dot active" data-section="hello"><span class="scroll-dot-label">Accueil</span></a>
750+
<a href="#about" class="scroll-dot" data-section="about"><span class="scroll-dot-label">Pourquoi</span></a>
751+
<a href="#expertise" class="scroll-dot" data-section="expertise"><span class="scroll-dot-label">Expertise</span></a>
752+
<a href="#clients" class="scroll-dot" data-section="clients"><span class="scroll-dot-label">Clients</span></a>
753+
<a href="#process" class="scroll-dot" data-section="process"><span class="scroll-dot-label">Process</span></a>
754+
<a href="#tech" class="scroll-dot" data-section="tech"><span class="scroll-dot-label">Stack</span></a>
755+
<a href="#contact-me" class="scroll-dot" data-section="contact-me"><span class="scroll-dot-label">Contact</span></a>
756+
</nav>
757+
747758
<!-- UIkit JS -->
748759
<script
749760
src="https://cdn.jsdelivr.net/npm/uikit@3.4.1/dist/js/uikit.min.js">
750761
</script>
751762
<script
752763
src="https://cdn.jsdelivr.net/npm/uikit@3.4.1/dist/js/uikit-icons.min.js">
753764
</script>
765+
766+
<script>
767+
(function() {
768+
var dots = document.querySelectorAll('.scroll-dot');
769+
var sections = Array.from(dots).map(function(dot) {
770+
return document.getElementById(dot.dataset.section);
771+
});
772+
773+
var nav = document.querySelector('.scroll-indicator');
774+
var lightSections = ['about', 'expertise', 'clients', 'process', 'tech', 'contact-me'];
775+
776+
function updateActive() {
777+
var scrollY = window.scrollY + window.innerHeight / 3;
778+
var current = 0;
779+
for (var i = 0; i < sections.length; i++) {
780+
if (sections[i] && sections[i].offsetTop <= scrollY) {
781+
current = i;
782+
}
783+
}
784+
dots.forEach(function(dot, i) {
785+
dot.classList.toggle('active', i === current);
786+
});
787+
var currentId = sections[current] ? sections[current].id : '';
788+
nav.classList.toggle('on-light', lightSections.indexOf(currentId) !== -1);
789+
}
790+
791+
var ticking = false;
792+
window.addEventListener('scroll', function() {
793+
if (!ticking) {
794+
requestAnimationFrame(function() {
795+
updateActive();
796+
ticking = false;
797+
});
798+
ticking = true;
799+
}
800+
});
801+
802+
dots.forEach(function(dot) {
803+
dot.addEventListener('click', function(e) {
804+
e.preventDefault();
805+
var target = document.getElementById(dot.dataset.section);
806+
if (target) {
807+
target.scrollIntoView({ behavior: 'smooth' });
808+
}
809+
});
810+
});
811+
812+
updateActive();
813+
})();
814+
</script>
754815
</body>
755816
</html>

style.css

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,102 @@ section#contact-me {
238238
position: relative;
239239
}
240240

241+
/* Scroll indicator */
242+
.scroll-indicator {
243+
position: fixed;
244+
right: 20px;
245+
top: 50%;
246+
transform: translateY(-50%);
247+
z-index: 100;
248+
display: flex;
249+
flex-direction: column;
250+
align-items: flex-end;
251+
gap: 12px;
252+
}
253+
254+
.scroll-dot {
255+
display: flex;
256+
align-items: center;
257+
text-decoration: none !important;
258+
gap: 8px;
259+
}
260+
261+
.scroll-dot::after {
262+
content: '';
263+
width: 12px;
264+
height: 3px;
265+
background: rgba(255, 255, 255, 0.3);
266+
border-radius: 2px;
267+
transition: all 0.3s ease;
268+
flex-shrink: 0;
269+
}
270+
271+
.scroll-dot.active::after {
272+
width: 24px;
273+
height: 4px;
274+
background: #fff;
275+
box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
276+
}
277+
278+
.scroll-dot:hover::after {
279+
background: rgba(255, 255, 255, 0.7);
280+
width: 18px;
281+
}
282+
283+
.scroll-dot.active:hover::after {
284+
background: #fff;
285+
width: 24px;
286+
}
287+
288+
.scroll-dot-label {
289+
font-size: 0.7rem;
290+
color: rgba(255, 255, 255, 0);
291+
transition: color 0.3s ease;
292+
white-space: nowrap;
293+
pointer-events: none;
294+
font-family: 'Raleway', sans-serif;
295+
font-weight: 400;
296+
letter-spacing: 0.5px;
297+
}
298+
299+
.scroll-dot:hover .scroll-dot-label,
300+
.scroll-dot.active .scroll-dot-label {
301+
color: rgba(255, 255, 255, 0.8);
302+
}
303+
304+
/* Adapt colors for light sections */
305+
.scroll-indicator.on-light .scroll-dot::after {
306+
background: rgba(0, 0, 0, 0.15);
307+
}
308+
309+
.scroll-indicator.on-light .scroll-dot.active::after {
310+
background: var(--main-bg-color);
311+
box-shadow: 0 0 8px rgba(229, 77, 66, 0.3);
312+
}
313+
314+
.scroll-indicator.on-light .scroll-dot:hover::after {
315+
background: rgba(0, 0, 0, 0.3);
316+
}
317+
318+
.scroll-indicator.on-light .scroll-dot.active:hover::after {
319+
background: var(--main-bg-color);
320+
}
321+
322+
.scroll-indicator.on-light .scroll-dot-label {
323+
color: rgba(0, 0, 0, 0);
324+
}
325+
326+
.scroll-indicator.on-light .scroll-dot:hover .scroll-dot-label,
327+
.scroll-indicator.on-light .scroll-dot.active .scroll-dot-label {
328+
color: rgba(0, 0, 0, 0.6);
329+
}
330+
331+
@media (max-width: 768px) {
332+
.scroll-indicator {
333+
display: none;
334+
}
335+
}
336+
241337
.scroll-to-top {
242338
position: absolute;
243339
right: 20px;

0 commit comments

Comments
 (0)