Created
November 4, 2020 17:30
-
-
Save leochocolat/1c91eda9c4e4693a4bcef6d62c1b705a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setupScrollParagraph() { | |
let scrollParagraph = this.$el.querySelector('.js-scroll-paragraph'); | |
let originalContent = scrollParagraph.innerHTML; | |
let splits = new SplitText(scrollParagraph, { | |
type: 'lines', | |
linesClass: 'line-container line-container--++', | |
}); | |
let lines = []; | |
for (let i = 0; i < splits.lines.length; i++) { | |
const element = splits.lines[i]; | |
let line = new SplitText(element, { | |
type: 'lines', | |
linesClass: 'line line--++', | |
}).lines; | |
lines.push(line[0]); | |
} | |
lines[lines.length - 1].addEventListener('transitionend', () => { | |
scrollParagraph.innerHTML = splits.originalHTML; | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment