From adf87b62edbd08029f688071e8883b3c62bece78 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 5 Oct 2022 17:36:23 +0200 Subject: [PATCH] feat: create scroll button on the home page --- src/assets/scroll_arrow.svg | 6 +++++ src/components/Home.vue | 49 ++++++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/assets/scroll_arrow.svg diff --git a/src/assets/scroll_arrow.svg b/src/assets/scroll_arrow.svg new file mode 100644 index 0000000..cd34b78 --- /dev/null +++ b/src/assets/scroll_arrow.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/components/Home.vue b/src/components/Home.vue index 3966317..b78a46b 100644 --- a/src/components/Home.vue +++ b/src/components/Home.vue @@ -4,18 +4,24 @@
+
+ +
@@ -42,6 +48,11 @@ to{ background-position-x: 100vw; } } + @keyframes fadeLoop { + from { opacity: 1.0; transform: translateY(-2%); } + to { opacity: 0.8; transform: translateY(2%); } + } + .wave { display: block; position: absolute; @@ -65,4 +76,40 @@ z-index: 900; } + $scroll-btn-size: 5rem; + + .scroll-arrow { + display: flex; + position: absolute; + top: calc( 100% - #{1.5*$wave-height} ); + left: calc( 50% - #{$scroll-btn-size/2} ); + width: $scroll-btn-size; + height: $scroll-btn-size; + + opacity: .7; + background: #fff; + + border-radius: 50% / 50%; + + z-index: 1000; + + flex-flow: row nowrap; + justify-content: center; + align-items: center; + + transition: opacity .2s ease-in-out; + + cursor: pointer; + + img { + width: #{.8*$scroll-btn-size}; + height: #{.8*$scroll-btn-size}; + animation: 1s ease-in-out fadeLoop infinite alternate-reverse; + } + + &:hover { + opacity: .9; + } + } +