-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from frorong/feature/convenience
Add scrollToTopButton and openGraph
- Loading branch information
Showing
9 changed files
with
54 additions
and
18 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<script lang="ts"> | ||
function scrollToTop() { | ||
const scrollStep = | ||
-window.scrollY / (500 / 15) | ||
const scrollInterval = setInterval( | ||
function () { | ||
if (window.scrollY !== 0) | ||
window.scrollBy(0, scrollStep) | ||
else | ||
clearInterval(scrollInterval) | ||
}, | ||
15 | ||
) | ||
} | ||
</script> | ||
|
||
<button | ||
class="fixed bottom-16 right-16 rounded-full bg-blue-500 px-4 py-2 text-white shadow-md transition duration-300 hover:bg-blue-600" | ||
on:click="{scrollToTop}" | ||
> | ||
<svg | ||
class="h-6 w-6" | ||
fill="none" | ||
stroke="currentColor" | ||
viewBox="0 0 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
stroke-width="2" | ||
d="M5 10l7-7m0 0l7 7m-7-7v18" | ||
></path> | ||
</svg> | ||
</button> |
Empty file.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const prerender = true | ||
export const prerender = false |