Add Go to top button

This commit is contained in:
Kushal K S V S 2017-08-27 13:26:40 -07:00
parent 13d3b701f0
commit fbaf709510
3 changed files with 29 additions and 0 deletions

View File

@ -663,6 +663,7 @@ void Print_Head( FILE* fp ){
<link href=\"../../../../../styles/top.css\" rel=\"stylesheet\" type=\"text/css\" >\n\
</head>\n\
<body>\n\
<button onclick=\"topFunction()\" id=\"myBtn\" title=\"Go to top\">Top</button>\n\
<table>\n\
<colgroup>\n\
<col span=\"3\" style=\"background-color:white\">\n\

View File

@ -92,3 +92,18 @@ function class_one_four(){
div.className = 'animation one_four';
}
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
document.getElementById("myBtn").style.display = "block";
} else {
document.getElementById("myBtn").style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}

View File

@ -34,6 +34,19 @@ th {
width: 50%;
height: auto;
}
#myBtn {
display: none;
position: fixed;
bottom: 10px;
right: 10px;
z-index: 99;
cursor: pointer;
padding: 15px;
border-radius: 10px;
background-color: #555;
color: white;
}
/*Top Page styling begins*/
#frame_1{
width:49%;