diff options
| author | Max | 2018-10-15 23:46:42 +0200 |
|---|---|---|
| committer | Max | 2018-10-15 23:46:42 +0200 |
| commit | 00c9709fd9763542e848f6278db8ba26af5c9886 (patch) | |
| tree | 92cb1c1ee4c467118e1e5a4c7e233d3feac6efa8 /src/js/scroll-to-top.js | |
| download | fuselkoenig_de-00c9709fd9763542e848f6278db8ba26af5c9886.tar.gz | |
Initial commit.
Diffstat (limited to 'src/js/scroll-to-top.js')
| -rw-r--r-- | src/js/scroll-to-top.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/js/scroll-to-top.js b/src/js/scroll-to-top.js new file mode 100644 index 0000000..5f898bd --- /dev/null +++ b/src/js/scroll-to-top.js @@ -0,0 +1,27 @@ +jQuery(window).load(function () { + jQuery(window).scroll(function () { + if (jQuery(this).scrollTop() > 50) { + jQuery('#back-to-top').fadeIn(); + jQuery('#back-to-top').tooltip(); + } else { + jQuery('#back-to-top').fadeOut(); + } + }); + // scroll body to 0px on click + jQuery('#back-to-top').click(function () { + jQuery('#back-to-top').tooltip('hide'); + jQuery('body,html').animate({ + scrollTop: 0 + }, 'slow'); + return false; + }); + + if ( jQuery('#back-to-top').is(":visible") ) { + jQuery('#back-to-top').tooltip('show'); + } +}); +/* +window.onload = function(){ + +}; +*/ |
