jade
.fixed
p.pagetop
a(href='#top')
img(src='pagetop.gif', alt='トップへ戻る')
coffee
$ ->
wantToShow = 85
$(window).scroll(()->
percentage = $(this).scrollTop() / ($(document).height() - $(this).height()) * 100
if percentage > wantToShow
$('.fixed').addClass('is-active')
else
$('.fixed').removeClass('is-active')
)
scss
$mouseover:.15s;
.fixed {
@include transition(opacity, $mouseover, linear);
@include opacity(0);
position: fixed;
right: 18px;
bottom: 200px;
z-index: -1;
&.is-active {
@include opacity(1);
z-index: 1;
}
}