diedVIPs

html knowhow

Button go to top








 script © 2013 by webdesign weisshart



Button go to top

So sieht´s aus
Sehen sie nach rechts unten, wenn sie runterscrollen


Quellcode
<html>

<head>
<style type="text/css">
#sttop {position:relative;}
#sttop #scrtop {position:fixed; top:80%; right:1.1%; width:1.8em; cursor:pointer; text-align:center; font-family:Calibri, Arial, sans-serif; line-height:1.4em; font-size:.75em;
padding:0; font-weight:800; color:blue; border-bottom: 1.85em solid #ebeb00; border-top: .78em solid #ebeb00; border-left: 1em solid transparent; border-right: 1em solid transparent; height: 0;}
#sttop #scrtop:hover {border-color: #9eef9f; color:#000100; border-radius:1.1em;}
#sttop #scrtop span {display:block; margin:-8px auto -1px auto; font-size:1.9em; color:#fb0000;}
</style>
</head>

<body >
<script>
var whenScrlBottom = function() {
var win_h = (self.innerHeight) ? self.innerHeight : document.body.clientHeight; // gets window height
var scrl_pos = window.pageYOffset ? window.pageYOffset : document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
if (document.body.scrollHeight <= (scrl_pos + win_h)) {
alert('Bottom'); } }
window.onscroll = whenScrlBottom;
</script>
<div id="sttop"></div>
<script>
var scrTop = new Object();
scrTop.scrollY = function() {
return window.pageYOffset ? window.pageYOffset : document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop; }
scrTop.brows_height = function() {
if (self.innerHeight) {
var brows_hgh = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) {
var brows_hgh = document.documentElement.clientHeight;
} else if (document.body) {
var brows_hgh = document.body.clientHeight; }
return brows_hgh; }
scrTop.onScrollWin = function() {
if(document.getElementById('sttop')) {
window.onscroll = function() {
var scrl_pos = scrTop.scrollY();
if(scrl_pos > (scrTop.brows_height() *.5) && !document.getElementById('scrtop')) {
document.getElementById('sttop').innerHTML = '<div id="scrtop" onclick="window.scrollTo(0,0)"><span>&uArr;</span>TOP</div>'; }
else if(scrl_pos < (scrTop.brows_height() *.5) && document.getElementById('scrtop')) {
document.getElementById('sttop').removeChild(document.getElementById('scrtop')); } } } }
scrTop.onScrollWin();
</script>
</body>

</html>







Kontakt    Datenschutz   Impressum