Advertisement
ArtSemkin

Untitled

Jun 10th, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1.  
  2. // scroll-to-top button functionality
  3. (function($) {
  4. $('body').append('<a href="#" title="Scroll to Top" class="scrollup">Scroll</a>');
  5. $(window).scroll(function() {
  6. if ($(this).scrollTop() > 300) {
  7. $('.scrollup').fadeIn(850);
  8. } else {
  9. $('.scrollup').fadeOut(850);
  10. }
  11. });
  12. $('.scrollup').click(function () {
  13. if (typeof window.SB !== 'undefined') {
  14. window.SB.scrollTo(0, 0, 800);
  15. } else {
  16. $("html, body").animate({
  17. scrollTop: 0
  18. }, 850);
  19. }
  20. return false;
  21. });
  22. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement