Skip to content

Commit

Permalink
Merge pull request #33 from PiyushK79/main
Browse files Browse the repository at this point in the history
Added back to top button
  • Loading branch information
ShekharHans authored Oct 12, 2023
2 parents a97dafa + ca6dce7 commit 31d3079
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion css/footer.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
flex-direction: column;
padding: 20px;
gap: 20px;
margin-top: 80px;
margin-top: 50px;
}
.footer h1{
color: var(--gray);
Expand Down
16 changes: 16 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,20 @@ main{
}
#change-theme:hover{
background-color: transparent;
}

.back-to-top{
margin-top: 30px;
margin-left: 50%;
width:0px;
height: 0px;
background: transparent;
cursor: pointer;
}

.top-btn{
transform: rotate(180deg);
width: 35px;
height: 35px;
transition: all 0.5s ease-in;
}
7 changes: 7 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ <h1>Photo <b>Gallery</b></h1>

</div>
</div>
<button onclick="document.body.scrollTop=0;
document.documentElement.scrollTop=0;
event.preventDefault()"
class="back-to-top"><span>
<img class="top-btn" src="./public/Backtotop.png" alt="">
</span>
</button>
</div>
<!-- footer section -->

Expand Down
4 changes: 1 addition & 3 deletions js/photo-gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,4 @@ right.addEventListener("click", ()=>{
photogallery.scrollLeft += photogallery.clientWidth/2;
console.log(j);

})


})
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/Backtotop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 31d3079

Please sign in to comment.