Added scroll to top button

This commit is contained in:
BNoiZe
2013-10-01 21:52:43 +02:00
parent d55cccda39
commit b56149f3f3
4 changed files with 27 additions and 15 deletions

View File

@@ -929,4 +929,16 @@ label.nobr {
caption {
font-weight:700;
margin-bottom:.2em;
}
.scrollup {
width:40px;
height:40px;
opacity:0.3;
position:fixed;
bottom:15px;
left:100px;
display:none;
text-indent:-9999px;
background: url(../img/top.png) no-repeat;
}

BIN
templates/Sparkle/assets/img/top.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -6,10 +6,19 @@ function twoDigits(value) {
}
$(document).ready(function() {
// Format date in header
var lastlogin = new Date($("#lastlogin").text() * 1000);
//var d = Date.parse(lastlogin);
$("#lastlogin").text(lastlogin.getFullYear() + "-" + twoDigits(lastlogin.getMonth()) + "-" + twoDigits(lastlogin.getDate()) + " " + twoDigits(lastlogin.getHours()) + ":" + twoDigits(lastlogin.getMinutes()) + ":" + twoDigits(lastlogin.getSeconds()));
// Scroll to top
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
$('.scrollup').fadeIn();
} else {
$('.scrollup').fadeOut();
}
});
$('.scrollup').click(function() {
$("html, body").animate({ scrollTop: 0 }, 600);
return false;
});
// this is necessary for the special setting feature (ref #1010)
$.getQueryVariable = function(key) {
@@ -40,22 +49,12 @@ $(document).ready(function() {
// make rel="external" links open in a new window
$("a[rel='external']").attr('target', '_blank');
$(".main").css('min-height', $("nav").height() - 134);
//$(".dboarditem:last").css('min-height', $(".dboarditem:first").height());
//$(".dboarditem:first").css('min-height', $(".dboarditem:last").height());
// set focus on username-field if on loginpage
if ($(".loginpage").length != 0) {
$("#loginname").focus();
}
/*if ($("table.formtable").length != 0) {
$("table.formtable tr").hover(function() {
$(this).css("background-color", "#f5f5f5");
}, function() {
$(this).css("background-color", "#fff");
});
}*/
if ($("table.bradiusodd").length != 0) {
$("table.bradiusodd tbody tr").hover(function() {
$(this).css("background-color", "#f5f5f5");

View File

@@ -10,5 +10,6 @@
<br /><span>{$lng['panel']['translator']}: {$lng['translator']}
</if>
</footer>
<a href="#" class="scrollup">Scroll</a>
</body>
</html>