Skip to content

Commit

Permalink
update: keep scroll only on main pages
Browse files Browse the repository at this point in the history
refactor: change resume layout name to main layout
  • Loading branch information
mahiarirani committed Oct 20, 2023
1 parent 7d5f2d4 commit 773cb7b
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/_layouts/resume.njk → src/_layouts/main.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: base
---
<div class="grid gap-5 lg:grid-cols-3">
<div class="grid gap-5 lg:grid-cols-3 keep-scroll">
<!-- Left Side -->
<aside class="space-y-5">
{% include "blocks/user.njk" %}
Expand Down
8 changes: 5 additions & 3 deletions src/assets/js/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
window.addEventListener('scroll', function () {
localStorage.top = window.scrollY;
if (document.getElementsByClassName('keep-scroll').length)
localStorage.top = window.scrollY;
})
window.addEventListener('load', function () {
window.scrollTo({top: localStorage.top || 0, behavior: 'smooth'});
})
if (document.getElementsByClassName('keep-scroll').length)
window.scrollTo({top: localStorage.top || 0, behavior: 'smooth'});
})
2 changes: 1 addition & 1 deletion src/blog/index.njk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: resume
layout: main
type: blog
keywords:
- blog
Expand Down
2 changes: 1 addition & 1 deletion src/education.njk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: resume
layout: main
type: section
keywords:
- education
Expand Down
2 changes: 1 addition & 1 deletion src/experience.njk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: resume
layout: main
type: section
keywords:
- experience
Expand Down
2 changes: 1 addition & 1 deletion src/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: resume
layout: main
type: article
keywords:
- Biography
Expand Down
2 changes: 1 addition & 1 deletion src/projects.njk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: resume
layout: main
type: section
keywords:
- projects
Expand Down
2 changes: 1 addition & 1 deletion src/skills.njk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: resume
layout: main
type: section
keywords:
- skills
Expand Down

0 comments on commit 773cb7b

Please sign in to comment.