This file contains hidden or 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
| export const scrollToTop = () => { | |
| const c = document.documentElement.scrollTop || document.body.scrollTop; | |
| if (c > 0) { | |
| window.requestAnimationFrame(scrollToTop); | |
| window.scrollTo(0, c - c / 8); | |
| } | |
| }; | |
| export const getScrollPosition = (el = window) => |
This file contains hidden or 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
| const scrollToTop = () => { | |
| const c = document.documentElement.scrollTop || document.body.scrollTop; | |
| if (c > 0) { | |
| window.requestAnimationFrame(scrollToTop); | |
| window.scrollTo(0, c - c / 8); | |
| } | |
| }; |
This file contains hidden or 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
| //findCallBack: (item, rawItem) => boolean | |
| const filterDuplicateWhen = (array, findCallback) => { | |
| return array.filter((item, index, rawArray) => | |
| rawArray.findIndex(rawItem => findCallback(item, rawItem)) === index | |
| ); | |
| }; |
This file contains hidden or 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
| const randomKey = (width = 6) => { | |
| const randomNum = Math.random(); | |
| return randomNum.toString(16).slice(-1 * width); | |
| }; |
This file contains hidden or 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
| <div class="bottom"> | |
| <div class="paper"> | |
| <p>You are<br>the <span class="highlight">CSS</span><br>to my <span class="highlight">HTML</span></p> | |
| </div> | |
| </div> |