nav, main, footer, there are 3 tags. I applied them to FlexBox :
body {
color: #ddd;
font-family: Gotham;
background: url(../assets/body-background.png);
display: flex;
min-height: 100%;
flex-direction: column;
}
main {
flex: 1;
}
everything looks so good. but things are getting worse after that
I have the following code in my script file (using jQuery):
$('.scroll-top').click(function () {
$('body').animate({
scrollTop: 0
}, 1000);
})
but the page scrolling animation is not working
$('a').click(function(){
$('body').animate({
scrollTop: 0
}, 1000);
})
nav{
padding: 10px;
background: grey;
}
main{
height:800px;
background: lightgrey;
}
footer{
padding: 10px;
background: grey;
}
body{
display: flex;
min-height: 100vh;
flex-direction: column;
}
main{
flex: 1;
}
a{
position: fixed;
right: 40px;
bottom: 40px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<nav>nav content</nav>
<main>main content</main>
<a href="javascript:;">scroll top</a>
<footer>footer content</footer>