Skip to content

Commit

Permalink
Move code about Lenis to a separate js file
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWillCom committed Aug 27, 2024
1 parent 63d82f6 commit f8c509f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
11 changes: 1 addition & 10 deletions layout/_partial/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,7 @@
<% if (theme.smooth_scroll) { %>
<script src="<%- getCdnUrl('lenis', '1.1.9', 'dist/lenis.min.js') %>"></script>
<%- css(getCdnUrl('lenis', '1.1.9', 'dist/lenis.css')) %>
<script>
const lenis = new Lenis()
function raf(time) {
lenis.raf(time)
requestAnimationFrame(raf)
}
requestAnimationFrame(raf)
</script>
<%- js('js/smooth-scroll.js') %>
<% } %>

<% if (config.waline) { %>
Expand Down
8 changes: 8 additions & 0 deletions source/js/smooth-scroll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const lenis = new Lenis()

function raf(time) {
lenis.raf(time)
requestAnimationFrame(raf)
}

requestAnimationFrame(raf)

0 comments on commit f8c509f

Please sign in to comment.