{"id":13692553,"date":"2020-11-21T19:18:50","date_gmt":"2020-11-21T19:18:50","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/improved-functionality-2\/"},"modified":"2020-11-21T19:18:50","modified_gmt":"2020-11-21T19:18:50","slug":"improved-functionality-2","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/improved-functionality-2\/","title":{"rendered":"improved functionality"},"content":{"rendered":"<p>hi,<br \/>\ni&#8217;ve found, that setting<\/p>\n<p>html, body { height: 100%; } \/* it may be any value set *\/<\/p>\n<p>makes To Top not working (button is not displayed), but I&#8217;ve found solution &#8211; you need to check &#8216;window&#8217; <strong>and<\/strong> &#8216;body&#8217; for scrollTop, and set .scroll( fnScroll ) for &#8216;body&#8217; also in to-top-public.js.<br \/>\nmozilla and chromium-based browsers verified (but not webkit)<\/p>\n<p>see code (modified to-top-public.js content):<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n( function ( $ ) {<br \/>\n\t&#8220;use strict&#8221;;<br \/>\n\t$( function () {<br \/>\n\t\tvar container = $( &#8220;#to_top_scrollup&#8221; ).css( {<br \/>\n\t\t\topacity: 0,<br \/>\n\t\t} );<br \/>\n\t\tvar data = to_top_options;<br \/>\n\t\tvar mouse_over = false;<br \/>\n\t\tvar hideEventID = 0;<br \/>\n\t\tvar fnHide = function () {<br \/>\n\t\t\tclearTimeout( hideEventID );<br \/>\n\t\t\tif (container.is( &#8220;:visible&#8221; )) {<br \/>\n\t\t\t\tcontainer.stop().fadeTo( 200, 0, function () {<br \/>\n\t\t\t\t\tcontainer.hide();<br \/>\n\t\t\t\t\tmouse_over = false;<br \/>\n\t\t\t\t} );<br \/>\n\t\t\t}<br \/>\n\t\t};<br \/>\n\t\tvar fnHideEvent = function () {<br \/>\n\t\t\tif ( !mouse_over &amp;&amp; data.enable_autohide == 1 ) {<br \/>\n\t\t\t\tclearTimeout( hideEventID );<br \/>\n\t\t\t\thideEventID = setTimeout( function () {<br \/>\n\t\t\t\t\tfnHide();<br \/>\n\t\t\t\t}, data.autohide_time * 1000 );<br \/>\n\t\t\t}<br \/>\n\t\t};<br \/>\n\t\tvar scrollHandled = false;<br \/>\n\t\tvar fnScroll = function () {<br \/>\n\t\t\tif ( scrollHandled )<br \/>\n\t\t\t\treturn;<br \/>\n\t\t\tscrollHandled = true;<br \/>\n\t\t\tif ( $( window ).scrollTop() &gt; data.scroll_offset <strong>|| $( &#8220;body&#8221; ).scrollTop() &gt; data.scroll_offset<\/strong> ) { <em>\/\/ jmsz changed<\/em><br \/>\n\t\t\t\tcontainer.stop().css( &#8220;opacity&#8221;, mouse_over ? 1 : parseFloat( data.icon_opacity \/ 100 ) ).show();<br \/>\n\t\t\t\tfnHideEvent();<br \/>\n\t\t\t} else {<br \/>\n\t\t\t\tfnHide();<br \/>\n\t\t\t}<br \/>\n\t\t\tscrollHandled = false;<br \/>\n\t\t};<br \/>\n\t\tif ( &#8220;undefined&#8221; != typeof to_top_options.enable_hide_small_device &amp;&amp; &#8220;1&#8221; == to_top_options.enable_hide_small_device ) {<br \/>\n\t\t\tif ( $( window ).width() &gt; to_top_options.small_device_max_width ) {<br \/>\n\t\t\t\t$( window ).scroll( fnScroll );<br \/>\n\t\t\t\t$( document ).scroll( fnScroll );<br \/>\n\t\t\t\t<strong>$( &#8220;body&#8221; ).scroll( fnScroll );<\/strong> <em>\/\/ jmsz added<\/em><br \/>\n\t\t\t}<br \/>\n\t\t} else {<br \/>\n\t\t\t$( window ).scroll( fnScroll );<br \/>\n\t\t\t$( document ).scroll( fnScroll );<br \/>\n\t\t\t<strong>$(&#8220;body&#8221;).scroll( fnScroll );<\/strong> \/\/ <em>jmsz added<\/em><br \/>\n\t\t}<br \/>\n\t\tcontainer<br \/>\n\t\t\t.hover( function () {<br \/>\n\t\t\t\t\tclearTimeout( hideEventID );<br \/>\n\t\t\t\t\tmouse_over = true;<br \/>\n\t\t\t\t\t$( this ).css( &#8220;opacity&#8221;, 1 );<br \/>\n\t\t\t\t}, function () {<br \/>\n\t\t\t\t\t$( this ).css(&#8220;opacity&#8221;, parseFloat( data.icon_opacity \/ 100) );<br \/>\n\t\t\t\t\tmouse_over = false;<br \/>\n\t\t\t\t\tfnHideEvent();<br \/>\n\t\t\t\t} )<br \/>\n\t\t\t.click(function () {<br \/>\n\t\t\t\t$( &#8220;html, body&#8221; ).animate( {<br \/>\n\t\t\t\t\t\tscrollTop: 0,<br \/>\n\t\t\t\t\t}, 400 );<br \/>\n\t\t\t\treturn false;<br \/>\n\t\t\t} );<br \/>\n\t} );<br \/>\n} )( jQuery );<\/p>\n","protected":false},"template":"","class_list":["post-13692553","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/13692553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/13692553\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=13692553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}