Created
November 27, 2018 22:40
-
-
Save peteee/add0aedd44839f6bae9cfcbbd6ca461d to your computer and use it in GitHub Desktop.
Paste'N'Ready
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Scroll Top Arrow | |
*/ | |
jQuery('body').append('<div id="scroll-top" style="display:none;position: fixed;bottom: 40px;right: 40px;color: #000;font-size: 56px;z-index: 999999;height: 70px;width: 70px;transform: rotate(-90deg) scale(1,1.2);text-shadow: -1px -1px 0 #FFF, 1px -1px 0 #FFF, -1px 1px 0 #FFF, 1px 1px 0 #FFF;cursor: pointer;">➤</div>'); | |
jQuery(document).scroll(function() { | |
var y = jQuery(this).scrollTop(); | |
if (y > 1200) { | |
jQuery('#scroll-top').fadeIn(); | |
} else { | |
jQuery('#scroll-top').fadeOut(); | |
} | |
}); | |
jQuery('#scroll-top').click(function () { | |
jQuery('body,html').animate({ | |
scrollTop: 1 | |
}, 800); | |
return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment