added scroll to top button

This commit is contained in:
kay.one 2013-06-24 22:47:56 -07:00
parent 25581c8051
commit 272cc93bd2
4 changed files with 97 additions and 45 deletions

View File

@ -1,6 +1,7 @@
@import "bootstrap/variables"; @import "bootstrap/variables";
@import "bootstrap/mixins"; @import "bootstrap/mixins";
@import "bootstrap/type"; @import "bootstrap/type";
@import "../shared/styles/clickable";
.progress { .progress {
width : 125px; width : 125px;
@ -13,6 +14,7 @@
font-size : 12px; font-size : 12px;
text-align : center; text-align : center;
} }
.progressbar-front-text { .progressbar-front-text {
display : block; display : block;
width : 125px; width : 125px;
@ -101,3 +103,20 @@ a:focus {
.label, .badge { .label, .badge {
cursor : default; cursor : default;
} }
#scroll-up {
&:hover {
text-decoration : none;
opacity : 0.4;
}
.clickable;
opacity : 0.2;
position : fixed;
bottom : 50px;
right : 50px;
display : none;
font-size : 56px;
color : white;
}

View File

@ -64,6 +64,9 @@
<div id="modal-region"></div> <div id="modal-region"></div>
</div> </div>
</div> </div>
<a id="scroll-up" title="Back to the top!">
<i class="icon-circle-arrow-up"></i>
</a>
</div> </div>
<footer> <footer>
<div class="container"> <div class="container">

View File

@ -32,9 +32,16 @@ require.config({
[ [
'Instrumentation/ErrorHandler' 'Instrumentation/ErrorHandler'
], ],
exports: '$' exports: '$',
},
init: function () {
require(
[
'jQuery/ToTheTop'
]);
}
},
signalR: { signalR: {
deps: deps:

23
UI/jQuery/ToTheTop.js Normal file
View File

@ -0,0 +1,23 @@
'use strict';
define(
[
'bootstrap'
], function () {
$(document).ready(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('#scroll-up').fadeIn();
}
else {
$('#scroll-up').fadeOut();
}
});
$('#scroll-up').click(function () {
$("html, body").animate({ scrollTop: 0 }, 600);
return false;
});
});
});