-
Notifications
You must be signed in to change notification settings - Fork 1
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 #52 from Valik3201/feat/scrollUp
scroll Up
- Loading branch information
Showing
11 changed files
with
141 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const button = document.querySelector('#scrollUp'); | ||
|
||
function scrollUp() { | ||
window.scrollTo(0, 0); | ||
} | ||
|
||
function scrollFunction() { | ||
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { | ||
button.style.display = 'block'; | ||
} else { | ||
button.style.display = 'none'; | ||
} | ||
} | ||
|
||
button.addEventListener('click', scrollUp); | ||
document.addEventListener('scroll', scrollFunction); |
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,21 @@ | ||
<div class="foundation-list"></div> | ||
<div class="foundation-list"> | ||
<div class="swiper"> | ||
<!-- Additional required wrapper --> | ||
<div class="swiper-wrapper"> | ||
<!-- Slides --> | ||
<div class="swiper-slide">Slide 1</div> | ||
<div class="swiper-slide">Slide 2</div> | ||
<div class="swiper-slide">Slide 3</div> | ||
... | ||
</div> | ||
<!-- If we need pagination --> | ||
<div class="swiper-pagination"></div> | ||
|
||
<!-- If we need navigation buttons --> | ||
<div class="swiper-button-prev"></div> | ||
<div class="swiper-button-next"></div> | ||
|
||
<!-- If we need scrollbar --> | ||
<div class="swiper-scrollbar"></div> | ||
</div> | ||
</div> |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#scrollUp { | ||
z-index: 1000; | ||
cursor: pointer; | ||
width: 50px; | ||
height: 50px; | ||
opacity: 0.7; | ||
fill: #000; | ||
|
||
background-color: #fcfcfc; | ||
border: none; | ||
border-radius: 50%; | ||
justify-content: center; | ||
align-items: center; | ||
transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), | ||
opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1); | ||
display: flex; | ||
position: fixed; | ||
bottom: 95px; | ||
right: 30px; | ||
transform: scale(1); | ||
box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15); | ||
|
||
} | ||
|
||
#scrollUp:hover { | ||
opacity: 1; | ||
transform: scale(1.1); | ||
} | ||
|
||
#scrollUp svg use { | ||
fill: #000; | ||
height: 20px; | ||
width: 20px; | ||
} | ||
|
||
#scrollUp:hover svg { | ||
fill: #f8d24e; | ||
} |
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:opsz,[email protected],400;9..40,500;9..40,700&display=swap"); | ||
* { | ||
box-sizing: border-box; | ||
scroll-behavior: smooth; | ||
} | ||
|
||
html, | ||
|
@@ -362,4 +363,38 @@ body { | |
[data-content=category] .books__book { | ||
flex-basis: calc(20% - 25px); | ||
} | ||
} | ||
#scrollUp { | ||
z-index: 1000; | ||
cursor: pointer; | ||
width: 50px; | ||
height: 50px; | ||
opacity: 0.7; | ||
fill: #000; | ||
background-color: #fcfcfc; | ||
border: none; | ||
border-radius: 50%; | ||
justify-content: center; | ||
align-items: center; | ||
transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1); | ||
display: flex; | ||
position: fixed; | ||
bottom: 95px; | ||
right: 30px; | ||
transform: scale(1); | ||
box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15); | ||
} | ||
|
||
#scrollUp:hover { | ||
opacity: 1.1; | ||
background-color: rgba(252, 252, 252, 0.5490196078); | ||
cursor: pointer; | ||
} | ||
|
||
#top-btn svg { | ||
fill: #000; | ||
} | ||
|
||
#top-btn:hover svg { | ||
fill: #f8d24e; | ||
}/*# sourceMappingURL=main.css.map */ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
@import './home'; | ||
@import './category-list'; | ||
@import './books'; | ||
@import './scrollUp'; |