Added a scroll to the top thingy and a bit more work on headphones

This commit is contained in:
tidusjar 2016-03-30 13:59:13 +01:00
commit f7c33d48f4
11 changed files with 151 additions and 13 deletions

View file

@ -87,8 +87,37 @@
</div>
</nav>
<div class="container">
@RenderBody()
<div class="container">
@RenderBody()
</div>
<div class="scroll-top-wrapper ">
<span class="scroll-top-inner">
<i class="fa fa-2x fa-arrow-circle-up"></i>
</span>
</div>
</body>
</html>
<script>
$(function () {
$(document).on('scroll', function () {
if ($(window).scrollTop() > 100) {
$('.scroll-top-wrapper').addClass('show');
} else {
$('.scroll-top-wrapper').removeClass('show');
}
});
$('.scroll-top-wrapper').on('click', scrollToTop);
});
function scrollToTop() {
verticalOffset = typeof (verticalOffset) != 'undefined' ? verticalOffset : 0;
element = $('body');
offset = element.offset();
offsetTop = offset.top;
$('html, body').animate({ scrollTop: offsetTop }, 500, 'linear');
}
</script>