Title: improved functionality
Last modified: November 21, 2020

---

# improved functionality

 *  [Marcin](https://wordpress.org/support/users/jmszwp/)
 * (@jmszwp)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/improved-functionality-2/)
 * hi,
    i’ve found, that setting
 * html, body { height: 100%; } /* it may be any value set */
 * makes To Top not working (button is not displayed), but I’ve found solution –
   you need to check ‘window’ **and** ‘body’ for scrollTop, and set .scroll( fnScroll)
   for ‘body’ also in to-top-public.js.
    mozilla and chromium-based browsers verified(
   but not webkit)
 * see code (modified to-top-public.js content):
    ——————————————— ( function ( $){“
   use strict”; $( function () { var container = $( “#to_top_scrollup” ).css( { 
   opacity: 0, } ); var data = to_top_options; var mouse_over = false; var hideEventID
   = 0; var fnHide = function () { clearTimeout( hideEventID ); if (container.is(“:
   visible” )) { container.stop().fadeTo( 200, 0, function () { container.hide();
   mouse_over = false; } ); } }; var fnHideEvent = function () { if ( !mouse_over&&
   data.enable_autohide == 1 ) { clearTimeout( hideEventID ); hideEventID = setTimeout(
   function () { fnHide(); }, data.autohide_time * 1000 ); } }; var scrollHandled
   = false; var fnScroll = function () { if ( scrollHandled ) return; scrollHandled
   = true; if ( $( window ).scrollTop() > data.scroll_offset **|| $( “body” ).scrollTop()
   > data.scroll_offset** ) { _// jmsz changed_ container.stop().css( “opacity”,
   mouse_over ? 1 : parseFloat( data.icon_opacity / 100 ) ).show(); fnHideEvent();}
   else { fnHide(); } scrollHandled = false; }; if ( “undefined” != typeof to_top_options.
   enable_hide_small_device && “1” == to_top_options.enable_hide_small_device ) {
   if ( $( window ).width() > to_top_options.small_device_max_width ) { $( window).
   scroll( fnScroll ); $( document ).scroll( fnScroll ); **$( “body” ).scroll( fnScroll);**_//
   jmsz added_ } } else { $( window ).scroll( fnScroll ); $( document ).scroll( 
   fnScroll ); **$(“body”).scroll( fnScroll );** // _jmsz added_ } container .hover(
   function () { clearTimeout( hideEventID ); mouse_over = true; $( this ).css( “
   opacity”, 1 ); }, function () { $( this ).css(“opacity”, parseFloat( data.icon_opacity/
   100) ); mouse_over = false; fnHideEvent(); } ) .click(function () { $( “html,
   body” ).animate( { scrollTop: 0, }, 400 ); return false; } ); } ); } )( jQuery);

The topic ‘improved functionality’ is closed to new replies.

 * ![](https://ps.w.org/to-top/assets/icon-256x256.png?rev=1340365)
 * [To Top](https://wordpress.org/plugins/to-top/)
 * [Support Threads](https://wordpress.org/support/plugin/to-top/)
 * [Active Topics](https://wordpress.org/support/plugin/to-top/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/to-top/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/to-top/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Marcin](https://wordpress.org/support/users/jmszwp/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/improved-functionality-2/)
 * Status: not a support question