div.wrap
a#top i'm top(scroll through the wrap)
a(href="#top").goTop1 back to the top
a.goTop2 go to top
body
height:2000px
background:#0b2431
color:#9cd8ed
.wrap
text-align:center;
.goTop1
position:fixed;
top:50%;
left:30%;
width:40px;
height:80px;
background:#1e3745
color:#9cd8ed
text-decoration:none
text-align:center
.goTop2
position:fixed;
top:50%;
left:50%;
width:30px;
height:80px;
background:#1e3745
color:#9cd8ed
text-align:center
cursor:pointer
display:none
var goTop = $('.goTop2');
$(window).scroll(function() {
if ($(window).scrollTop() > 100) {
$(goTop).fadeIn("slow");
} else {
$(goTop).fadeOut("slow");
}
})
goTop.click(function() {
$('html, body').animate({
scrollTop : 0
}, 200);
})