With the following code I managed to make the icon not go over the footer area, but instead remaing in the body.
This was requested by some clients, so here it is:

(function($) {
  Drupal.behaviors.scroll_top_top_not_over_footer = {
    attach: function (context, settings) {
      $(document).scroll(function() {
        if($('#back-top').offset().top + $('#back-top').height() >= $('footer').offset().top - 10)
          $('#back-top').css('bottom', $('footer').height() + 30);
          $('#back-top').css('transition', 'bottom 2s');
        if($(document).scrollTop() + window.innerHeight < $('footer').offset().top)
          $('#back-top').css('bottom', '10px'); // restore when you scroll up
      });
    }
  };
})(jQuery);

Comments

bserem created an issue. See original summary.

bserem’s picture

astonvictor’s picture

Status: Active » Closed (outdated)

D7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.