{"id":55,"date":"2026-02-28T10:58:00","date_gmt":"2026-02-28T08:58:00","guid":{"rendered":"https:\/\/html-online.com\/articles\/?p=55"},"modified":"2026-03-01T12:11:16","modified_gmt":"2026-03-01T10:11:16","slug":"dynamic-scroll-back-top-page-button-javascript","status":"publish","type":"post","link":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/","title":{"rendered":"Scroll Back to Top Button With Progress Bar Indicator"},"content":{"rendered":"<p><strong>The<em> Back to Top &uarr;<\/em> button is a useful user interface element commonly found on web pages, particularly those with long scrolling content. This button allows users to quickly return to the top of the page with a single click, improving navigation efficiency and overall user experience.<\/strong><\/p>\n<p class=\"aligncenter\"><a href=\"https:\/\/onlinecube.com\/\" target=\"_blank\" rel=\"nofollow noopener\"><img decoding=\"async\" src=\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2024\/07\/back-to-top-progress-indicator-rubiks-cube.jpg\" alt=\"back to top progressbar demo\" \/><\/a><br \/><em>Visit <a href=\"https:\/\/onlinecube.com\/\" target=\"_blank\" rel=\"nofollow noopener\">OnlineCube.com<\/a> for the live demo.<\/em><\/p>\n<p><!--more--><\/p>\n<p>Enhancing this functionality, the integration of a progress bar indicator provides users with visual feedback on their scroll position relative to the entire page. This added feature not only makes the button more interactive but also informs users about their current location on the page and how much content remains to be explored \ud83d\uddb0, offering a better browsing experience.<\/p>\n<h3>HTML Code<\/h3>\n<p>The HTML structure creates a &#8220;Back to top&#8221; button using a clickable <strong>div<\/strong> element with a class of <strong>back2topScroll<\/strong>. Inside the <strong>div<\/strong>, there&#8217;s an SVG element containing a circular path. The SVG is used to create a circular progress bar around the button. The arrow itself is not added yet because this will be added with the ::after CSS property.<\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #007700\">&lt;div<\/span> <span style=\"color: #0000CC\">class=<\/span><span style=\"background-color: #fff0f0\">&quot;back2topScroll&quot;<\/span> <span style=\"color: #0000CC\">title=<\/span><span style=\"background-color: #fff0f0\">&quot;Scroll to top&quot;<\/span><span style=\"color: #007700\">&gt;<\/span>\n  <span style=\"color: #007700\">&lt;svg<\/span> <span style=\"color: #0000CC\">class=<\/span><span style=\"background-color: #fff0f0\">&quot;circleSvg&quot;<\/span> <span style=\"color: #0000CC\">viewBox=<\/span><span style=\"background-color: #fff0f0\">&quot;0 0 100 100&quot;<\/span><span style=\"color: #007700\">&gt;<\/span>\n    <span style=\"color: #007700\">&lt;path<\/span> <span style=\"color: #0000CC\">d=<\/span><span style=\"background-color: #fff0f0\">&quot;M50,1 a49,49 0 0,1 0,98 a49,49 0 0,1 0,-98&quot;<\/span><span style=\"color: #007700\">\/&gt;<\/span>\n  <span style=\"color: #007700\">&lt;\/svg&gt;<\/span>\n<span style=\"color: #007700\">&lt;\/div&gt;<\/span>\n<\/pre>\n<\/div>\n<h3>CSS<\/h3>\n<p>The CSS styles the button to be fixed at the bottom-right corner of the page. The button is initially hidden and becomes visible when scrolling down. The CSS also styles the SVG path to create the circular progress bar and adds hover effects to the button.<\/p>\n<p>The arrow inside the circle accomplished with the <strong>::after{content: &#8220;\\27A4&#8221;;}<\/strong> property and you can set a different <a href=\"https:\/\/oinam.github.io\/entities\/\" target=\"_blank\" rel=\"noopener\">character<\/a> for the hover inside the <strong>::before<\/strong> declaration.<\/p>\n<p>The color of the button is blue by default. You can change it to match your template by replacing the <strong>rgba(35, 130, 177,<\/strong>&#8230; bits in the CSS. Be careful because there is a separate opacity declared for hovering.<\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #888888\">\/* Scroll back to top BEGIN *\/<\/span>\n<span style=\"color: #BB0066; font-weight: bold\">.back2topScroll<\/span>{<span style=\"color: #008800; font-weight: bold\">position<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">fixed<\/span>;<span style=\"color: #008800; font-weight: bold\">right<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">25px<\/span>;<span style=\"color: #008800; font-weight: bold\">bottom<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">25px<\/span>;<span style=\"color: #008800; font-weight: bold\">height<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">46px<\/span>;<span style=\"color: #008800; font-weight: bold\">width<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">46px<\/span>;<span style=\"color: #008800; font-weight: bold\">cursor<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">pointer<\/span>;<span style=\"color: #008800; font-weight: bold\">display<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">block<\/span>;<span style=\"color: #008800; font-weight: bold\">border<\/span><span style=\"color: #333333\">-<\/span>radius<span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">50px<\/span>;box<span style=\"color: #333333\">-<\/span>shadow<span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">inset<\/span> <span style=\"color: #6600EE; font-weight: bold\">0<\/span> <span style=\"color: #6600EE; font-weight: bold\">0<\/span> <span style=\"color: #6600EE; font-weight: bold\">0<\/span> <span style=\"color: #6600EE; font-weight: bold\">2px<\/span> rgba(<span style=\"color: #6600EE; font-weight: bold\">0<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #6600EE; font-weight: bold\">0<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #6600EE; font-weight: bold\">0<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #6600EE; font-weight: bold\">0<\/span><span style=\"color: #333333\">.<\/span><span style=\"color: #6600EE; font-weight: bold\">1<\/span>);<span style=\"color: #008800; font-weight: bold\">z-index<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">10000<\/span>;<span style=\"color: #008800; font-weight: bold\">opacity<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">0<\/span>;<span style=\"color: #008800; font-weight: bold\">visibility<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">hidden<\/span>;transform<span style=\"color: #333333\">:<\/span>translateY(<span style=\"color: #6600EE; font-weight: bold\">15px<\/span>);<span style=\"color: #333333\">-<\/span>webkit<span style=\"color: #333333\">-<\/span>transition<span style=\"color: #333333\">:<\/span>all <span style=\"color: #6600EE; font-weight: bold\">250<\/span>ms linear;transition<span style=\"color: #333333\">:<\/span>all <span style=\"color: #6600EE; font-weight: bold\">250<\/span>ms linear}\n<span style=\"color: #BB0066; font-weight: bold\">.back2topScroll.showProgress<\/span>{<span style=\"color: #008800; font-weight: bold\">opacity<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">1<\/span>;<span style=\"color: #008800; font-weight: bold\">visibility<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">visible<\/span>;transform<span style=\"color: #333333\">:<\/span>translateY(<span style=\"color: #6600EE; font-weight: bold\">0<\/span>)}\n<span style=\"color: #BB0066; font-weight: bold\">.back2topScroll<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #555555; font-weight: bold\">:after<\/span>{<span style=\"color: #008800; font-weight: bold\">color<\/span><span style=\"color: #333333\">:<\/span>rgba(<span style=\"color: #6600EE; font-weight: bold\">35<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #6600EE; font-weight: bold\">130<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #6600EE; font-weight: bold\">177<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #6600EE; font-weight: bold\">0<\/span><span style=\"color: #333333\">.<\/span><span style=\"color: #6600EE; font-weight: bold\">4<\/span>);<span style=\"color: #008800; font-weight: bold\">position<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">absolute<\/span>;transform<span style=\"color: #333333\">:<\/span>rotate(<span style=\"color: #6600EE; font-weight: bold\">-90<\/span>deg);<span style=\"color: #008800; font-weight: bold\">content<\/span><span style=\"color: #333333\">:<\/span><span style=\"background-color: #fff0f0\">&quot;\\27A4&quot;<\/span>;<span style=\"color: #008800; font-weight: bold\">text-align<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">center<\/span>;<span style=\"color: #008800; font-weight: bold\">line-height<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">46px<\/span>;<span style=\"color: #008800; font-weight: bold\">font-size<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">24px<\/span>;<span style=\"color: #008800; font-weight: bold\">left<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">0<\/span>;<span style=\"color: #008800; font-weight: bold\">top<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">0<\/span>;<span style=\"color: #008800; font-weight: bold\">height<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">46px<\/span>;<span style=\"color: #008800; font-weight: bold\">width<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">46px<\/span>;<span style=\"color: #008800; font-weight: bold\">cursor<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">pointer<\/span>;<span style=\"color: #008800; font-weight: bold\">display<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">block<\/span>;<span style=\"color: #008800; font-weight: bold\">z-index<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">1<\/span>;<span style=\"color: #333333\">-<\/span>webkit<span style=\"color: #333333\">-<\/span>transition<span style=\"color: #333333\">:<\/span>all <span style=\"color: #6600EE; font-weight: bold\">250<\/span>ms linear;transition<span style=\"color: #333333\">:<\/span>all <span style=\"color: #6600EE; font-weight: bold\">250<\/span>ms linear}\n<span style=\"color: #BB0066; font-weight: bold\">.back2topScroll<\/span><span style=\"color: #555555; font-weight: bold\">:hover<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #555555; font-weight: bold\">:after<\/span>{<span style=\"color: #008800; font-weight: bold\">opacity<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">0<\/span>}\n<span style=\"color: #BB0066; font-weight: bold\">.back2topScroll<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #555555; font-weight: bold\">:before<\/span>{<span style=\"color: #008800; font-weight: bold\">background<\/span><span style=\"color: #333333\">:<\/span>rgba(<span style=\"color: #6600EE; font-weight: bold\">35<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #6600EE; font-weight: bold\">130<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #6600EE; font-weight: bold\">177<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #6600EE; font-weight: bold\">1<\/span>);<span style=\"color: #008800; font-weight: bold\">position<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">absolute<\/span>;transform<span style=\"color: #333333\">:<\/span>rotate(<span style=\"color: #6600EE; font-weight: bold\">-90<\/span>deg);<span style=\"color: #008800; font-weight: bold\">content<\/span><span style=\"color: #333333\">:<\/span><span style=\"background-color: #fff0f0\">&quot;\\27A4&quot;<\/span>;<span style=\"color: #008800; font-weight: bold\">text-align<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">center<\/span>;<span style=\"color: #008800; font-weight: bold\">line-height<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">46px<\/span>;<span style=\"color: #008800; font-weight: bold\">font-size<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">24px<\/span>;<span style=\"color: #008800; font-weight: bold\">opacity<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">0<\/span>;<span style=\"color: #333333\">-<\/span>webkit<span style=\"color: #333333\">-<\/span><span style=\"color: #008800; font-weight: bold\">background<\/span><span style=\"color: #333333\">-<\/span><span style=\"color: #008800; font-weight: bold\">clip<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">text<\/span>;<span style=\"color: #333333\">-<\/span>webkit<span style=\"color: #333333\">-<\/span><span style=\"color: #008800; font-weight: bold\">text<\/span><span style=\"color: #333333\">-<\/span>fill<span style=\"color: #333333\">-<\/span><span style=\"color: #008800; font-weight: bold\">color<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">transparent<\/span>;<span style=\"color: #008800; font-weight: bold\">left<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">0<\/span>;<span style=\"color: #008800; font-weight: bold\">top<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">0<\/span>;<span style=\"color: #008800; font-weight: bold\">height<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">46px<\/span>;<span style=\"color: #008800; font-weight: bold\">width<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">46px<\/span>;<span style=\"color: #008800; font-weight: bold\">cursor<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">pointer<\/span>;<span style=\"color: #008800; font-weight: bold\">display<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">block<\/span>;<span style=\"color: #008800; font-weight: bold\">z-index<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">2<\/span>;<span style=\"color: #333333\">-<\/span>webkit<span style=\"color: #333333\">-<\/span>transition<span style=\"color: #333333\">:<\/span>all <span style=\"color: #6600EE; font-weight: bold\">250<\/span>ms linear;transition<span style=\"color: #333333\">:<\/span>all <span style=\"color: #6600EE; font-weight: bold\">250<\/span>ms linear}\n<span style=\"color: #BB0066; font-weight: bold\">.back2topScroll<\/span><span style=\"color: #555555; font-weight: bold\">:hover<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #555555; font-weight: bold\">:before<\/span>{<span style=\"color: #008800; font-weight: bold\">opacity<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">1<\/span>;<span style=\"color: #008800; font-weight: bold\">top<\/span><span style=\"color: #333333\">:-<\/span><span style=\"color: #6600EE; font-weight: bold\">5px<\/span>}\n<span style=\"color: #BB0066; font-weight: bold\">.back2topScroll<\/span> <span style=\"color: #007700\">svg<\/span> <span style=\"color: #007700\">path<\/span>{fill<span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">none<\/span>}\n<span style=\"color: #BB0066; font-weight: bold\">.back2topScroll<\/span> <span style=\"color: #007700\">svg<\/span><span style=\"color: #BB0066; font-weight: bold\">.circleSvg<\/span> <span style=\"color: #007700\">path<\/span>{stroke<span style=\"color: #333333\">:<\/span>rgba(<span style=\"color: #6600EE; font-weight: bold\">35<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #6600EE; font-weight: bold\">130<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #6600EE; font-weight: bold\">177<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #6600EE; font-weight: bold\">0<\/span><span style=\"color: #333333\">.<\/span><span style=\"color: #6600EE; font-weight: bold\">4<\/span>);stroke<span style=\"color: #333333\">-<\/span><span style=\"color: #008800; font-weight: bold\">width<\/span><span style=\"color: #333333\">:<\/span><span style=\"color: #6600EE; font-weight: bold\">4<\/span>;box<span style=\"color: #333333\">-<\/span>sizing<span style=\"color: #333333\">:<\/span><span style=\"color: #008800; font-weight: bold\">border<\/span><span style=\"color: #333333\">-<\/span>box;<span style=\"color: #333333\">-<\/span>webkit<span style=\"color: #333333\">-<\/span>transition<span style=\"color: #333333\">:<\/span>all <span style=\"color: #6600EE; font-weight: bold\">250<\/span>ms linear;transition<span style=\"color: #333333\">:<\/span>all <span style=\"color: #6600EE; font-weight: bold\">250<\/span>ms linear}\n<span style=\"color: #888888\">\/* Scroll back to top END *\/<\/span>\n<\/pre>\n<\/div>\n<h3>JavaScript \/ jQuery<\/h3>\n<p>This script uses <a href=\"\/articles\/category\/jquery\/\">jQuery<\/a> to animate the button&#8217;s visibility and manage the <a href=\"\/articles\/simple-progress-bar\/\">progress indicator<\/a>. It calculates the length of the SVG path and updates the stroke offset as the user scrolls, creating a visual indication of how far down the page the user is. The script also animates scrolling to the top when the button is clicked.<\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #888888\">\/\/Scroll back to top BEGIN<\/span>\n(<span style=\"color: #008800; font-weight: bold\">function<\/span>($) { <span style=\"background-color: #fff0f0\">&quot;use strict&quot;<\/span>;\n  $(<span style=\"color: #007020\">document<\/span>).ready(<span style=\"color: #008800; font-weight: bold\">function<\/span>(){<span style=\"background-color: #fff0f0\">&quot;use strict&quot;<\/span>;\n    <span style=\"color: #008800; font-weight: bold\">var<\/span> progressPath <span style=\"color: #333333\">=<\/span> <span style=\"color: #007020\">document<\/span>.querySelector(<span style=\"background-color: #fff0f0\">&#39;.back2topScroll path&#39;<\/span>);\n    <span style=\"color: #008800; font-weight: bold\">var<\/span> pathLength <span style=\"color: #333333\">=<\/span> progressPath.getTotalLength();\n    progressPath.style.transition <span style=\"color: #333333\">=<\/span> progressPath.style.WebkitTransition <span style=\"color: #333333\">=<\/span> <span style=\"background-color: #fff0f0\">&#39;none&#39;<\/span>;\n    progressPath.style.strokeDasharray <span style=\"color: #333333\">=<\/span> pathLength <span style=\"color: #333333\">+<\/span> <span style=\"background-color: #fff0f0\">&#39; &#39;<\/span> <span style=\"color: #333333\">+<\/span> pathLength;\n    progressPath.style.strokeDashoffset <span style=\"color: #333333\">=<\/span> pathLength;\n    progressPath.getBoundingClientRect();\n    progressPath.style.transition <span style=\"color: #333333\">=<\/span> progressPath.style.WebkitTransition <span style=\"color: #333333\">=<\/span> <span style=\"background-color: #fff0f0\">&#39;stroke-dashoffset 10ms linear&#39;<\/span>;    \n    <span style=\"color: #008800; font-weight: bold\">var<\/span> updateProgress <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">function<\/span> () {\n      <span style=\"color: #008800; font-weight: bold\">var<\/span> scroll <span style=\"color: #333333\">=<\/span> $(<span style=\"color: #007020\">window<\/span>).scrollTop();\n      <span style=\"color: #008800; font-weight: bold\">var<\/span> height <span style=\"color: #333333\">=<\/span> $(<span style=\"color: #007020\">document<\/span>).height() <span style=\"color: #333333\">-<\/span> $(<span style=\"color: #007020\">window<\/span>).height();\n      <span style=\"color: #008800; font-weight: bold\">var<\/span> progress <span style=\"color: #333333\">=<\/span> pathLength <span style=\"color: #333333\">-<\/span> (scroll <span style=\"color: #333333\">*<\/span> pathLength <span style=\"color: #333333\">\/<\/span> height);\n      progressPath.style.strokeDashoffset <span style=\"color: #333333\">=<\/span> progress;\n    }\n    updateProgress();\n    $(<span style=\"color: #007020\">window<\/span>).scroll(updateProgress);  \n    <span style=\"color: #008800; font-weight: bold\">var<\/span> offset <span style=\"color: #333333\">=<\/span> <span style=\"color: #0000DD; font-weight: bold\">70<\/span>;\n    <span style=\"color: #008800; font-weight: bold\">var<\/span> duration <span style=\"color: #333333\">=<\/span> <span style=\"color: #0000DD; font-weight: bold\">500<\/span>;\n    jQuery(<span style=\"color: #007020\">window<\/span>).on(<span style=\"background-color: #fff0f0\">&#39;scroll&#39;<\/span>, <span style=\"color: #008800; font-weight: bold\">function<\/span>() {\n      <span style=\"color: #008800; font-weight: bold\">if<\/span> (jQuery(<span style=\"color: #008800; font-weight: bold\">this<\/span>).scrollTop() <span style=\"color: #333333\">&gt;<\/span> offset) {\n        jQuery(<span style=\"background-color: #fff0f0\">&#39;.back2topScroll&#39;<\/span>).addClass(<span style=\"background-color: #fff0f0\">&#39;showProgress&#39;<\/span>);\n      } <span style=\"color: #008800; font-weight: bold\">else<\/span> {\n        jQuery(<span style=\"background-color: #fff0f0\">&#39;.back2topScroll&#39;<\/span>).removeClass(<span style=\"background-color: #fff0f0\">&#39;showProgress&#39;<\/span>);\n      }\n    });        \n    jQuery(<span style=\"background-color: #fff0f0\">&#39;.back2topScroll&#39;<\/span>).on(<span style=\"background-color: #fff0f0\">&#39;click&#39;<\/span>, <span style=\"color: #008800; font-weight: bold\">function<\/span>(event) {\n      event.preventDefault();\n      jQuery(<span style=\"background-color: #fff0f0\">&#39;html, body&#39;<\/span>).animate({scrollTop<span style=\"color: #333333\">:<\/span> <span style=\"color: #0000DD; font-weight: bold\">0<\/span>}, duration);\n      <span style=\"color: #008800; font-weight: bold\">return<\/span> <span style=\"color: #008800; font-weight: bold\">false<\/span>;\n    })\n  });\n})(jQuery); \n<span style=\"color: #888888\">\/\/Scroll back to top END<\/span>\n<\/pre>\n<\/div>\n<h2>A More Simple, Minimalist Solution<\/h2>\n<p><strong>Here&#8217;s a more simple solution, without the progress indicator. This is the one used on our website so you can test it right away.<\/strong><br \/>\n<a title=\"Demo\" href=\"https:\/\/html-online.com\/demo\/scroll-to-top\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full\" src=\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2016\/11\/scroll-back-to-top-button-for-website.png\" alt=\"scroll back to top button for website\" width=\"386\" height=\"245\"><\/a><\/p>\n<p>You can see the <a title=\"Demo\" href=\"https:\/\/html-online.com\/demo\/scroll-to-top\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>live demo<\/strong><\/a> with gibberish text or just scroll down this page and look the bottom right corner of the site. It&#8217;s using the same widget.<\/p>\n<h2>HTML<\/h2>\n<p>Add the link below anywhere to your HTML source, for example in the footer before the closing &lt;\/body&gt; tag. For WordPress use the footer.php or any other template file that&#8217;s displayed on all pages. The link has a unique identifier, a tooltip title and contains a special arrow character (\u27a4), so we don&#8217;t have to use an image to display the arrow.<\/p>\n<pre style=\"background: #fff; color: #000;\"><span style=\"color: #1c02ff;\">&lt;<span style=\"font-weight: bold;\">a<\/span> <span style=\"font-style: italic;\">id<\/span>=<span style=\"color: #d80800;\">\"back2Top\"<\/span> <span style=\"font-style: italic;\">title<\/span>=<span style=\"color: #d80800;\">\"Back to top\"<\/span> <span style=\"font-style: italic;\">href<\/span>=<span style=\"color: #d80800;\">\"#\"<\/span>&gt;<\/span><span style=\"color: #c5060b; font-style: italic;\">&amp;#10148;<\/span><span style=\"color: #1c02ff;\">&lt;\/<span style=\"font-weight: bold;\">a<\/span>&gt;<\/span>\n<\/pre>\n<h2>CSS<\/h2>\n<p>Include the stylesheet and adjust it if your website&#8217;s design requires that. Set the size, colors, position, hover effect of the arrow. The HTML arrow character we used was originally pointing rightwards and this CSS code is rotating it counterclockwise to make it point upwards.<\/p>\n<pre style=\"background:#fff;color:#000\"><span style=\"font-style:italic\">#back2Top<\/span> {\n    <span style=\"color:#6d79de;font-weight:700\">width<\/span>: <span style=\"color:#cd0000;font-style:italic\">40<span style=\"color:#0100b6;font-weight:700\">px<\/span><\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">line-height<\/span>: <span style=\"color:#cd0000;font-style:italic\">40<span style=\"color:#0100b6;font-weight:700\">px<\/span><\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">overflow<\/span>: <span style=\"color:#06960e;font-weight:700\">hidden<\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">z-index<\/span>: <span style=\"color:#cd0000;font-style:italic\">999<\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">display<\/span>: <span style=\"color:#06960e;font-weight:700\">none<\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">cursor<\/span>: <span style=\"color:#06960e;font-weight:700\">pointer<\/span>;\n    -moz-transform: rotate(<span style=\"color:#cd0000;font-style:italic\">270<span style=\"color:#0100b6;font-weight:700\">deg<\/span><\/span>);\n    -webkit-transform: rotate(<span style=\"color:#cd0000;font-style:italic\">270<span style=\"color:#0100b6;font-weight:700\">deg<\/span><\/span>);\n    -o-transform: rotate(<span style=\"color:#cd0000;font-style:italic\">270<span style=\"color:#0100b6;font-weight:700\">deg<\/span><\/span>);\n    -ms-transform: rotate(<span style=\"color:#cd0000;font-style:italic\">270<span style=\"color:#0100b6;font-weight:700\">deg<\/span><\/span>);\n    transform: rotate(<span style=\"color:#cd0000;font-style:italic\">270<span style=\"color:#0100b6;font-weight:700\">deg<\/span><\/span>);\n    <span style=\"color:#6d79de;font-weight:700\">position<\/span>: <span style=\"color:#06960e;font-weight:700\">fixed<\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">bottom<\/span>: <span style=\"color:#cd0000;font-style:italic\">50<span style=\"color:#0100b6;font-weight:700\">px<\/span><\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">right<\/span>: <span style=\"color:#cd0000;font-style:italic\">0<\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">background-color<\/span>: <span style=\"color:#c5060b;font-style:italic\">#DDD<\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">color<\/span>: <span style=\"color:#c5060b;font-style:italic\">#555<\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">text-align<\/span>: <span style=\"color:#06960e;font-weight:700\">center<\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">font-size<\/span>: <span style=\"color:#cd0000;font-style:italic\">30<span style=\"color:#0100b6;font-weight:700\">px<\/span><\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">text-decoration<\/span>: <span style=\"color:#06960e;font-weight:700\">none<\/span>;\n}\n<span style=\"font-style:italic\">#back2Top<\/span><span style=\"font-style:italic\">:hover<\/span> {\n    <span style=\"color:#6d79de;font-weight:700\">background-color<\/span>: <span style=\"color:#c5060b;font-style:italic\">#DDF<\/span>;\n    <span style=\"color:#6d79de;font-weight:700\">color<\/span>: <span style=\"color:#c5060b;font-style:italic\">#000<\/span>;\n}\n<\/pre>\n<h2>JavaScript<\/h2>\n<p>Add this JavaScript code to your website theme and make sure jQuery is used.<br \/>\nThe script checks the height position on every page scroll and fades in the widget if it has reached the 100px limit while another event listener detects the button clicks and smoothly scrolls back to the top of the page.<\/p>\n<pre style=\"background:#fff;color:#000\"><span style=\"color:#00b418\">\/*Scroll to top when arrow up clicked BEGIN*\/<\/span>\n<span style=\"color:#687687\">$<\/span>(<span style=\"color:#6d79de;font-weight:700\">window<\/span>).<span style=\"color:#3c4c72;font-weight:700\">scroll<\/span>(function() {\n    var height <span style=\"color:#687687\">=<\/span> <span style=\"color:#687687\">$<\/span>(<span style=\"color:#6d79de;font-weight:700\">window<\/span>).scrollTop();\n    <span style=\"color:#0100b6;font-weight:700\">if<\/span> (height <span style=\"color:#687687\">&gt;<\/span> <span style=\"color:#cd0000;font-style:italic\">100<\/span>) {\n        <span style=\"color:#687687\">$<\/span>(<span style=\"color:#d80800\">'#back2Top'<\/span>).fadeIn();\n    } <span style=\"color:#0100b6;font-weight:700\">else<\/span> {\n        <span style=\"color:#687687\">$<\/span>(<span style=\"color:#d80800\">'#back2Top'<\/span>).fadeOut();\n    }\n});\n<span style=\"color:#687687\">$<\/span>(<span style=\"color:#6d79de;font-weight:700\">document<\/span>).ready(function() {\n    <span style=\"color:#687687\">$<\/span>(<span style=\"color:#d80800\">\"#back2Top\"<\/span>).<span style=\"color:#3c4c72;font-weight:700\">click<\/span>(function(<span style=\"color:#6d79de;font-weight:700\">event<\/span>) {\n        <span style=\"color:#6d79de;font-weight:700\">event<\/span>.preventDefault();\n        <span style=\"color:#687687\">$<\/span>(<span style=\"color:#d80800\">\"html, body\"<\/span>).animate({ scrollTop: <span style=\"color:#cd0000;font-style:italic\">0<\/span> }, <span style=\"color:#d80800\">\"slow\"<\/span>);\n        <span style=\"color:#0100b6;font-weight:700\">return<\/span> <span style=\"color:#585cf6;font-style:italic\">false<\/span>;\n    });\n\n});\n <span style=\"color:#00b418\">\/*Scroll to top when arrow up clicked END*\/<\/span>\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The Back to Top &uarr; button is a useful user interface element commonly found on web pages, particularly those with long scrolling content. This button allows users to quickly return to the top of the page with a single click, improving navigation efficiency and overall user experience. Visit OnlineCube.com for the live demo.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3,4,5,6],"tags":[],"class_list":["post-55","post","type-post","status-publish","format-standard","hentry","category-css","category-freebies","category-html","category-javascript","category-jquery"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Simple Scroll Back to Top of the Page Button JavaScript<\/title>\n<meta name=\"description\" content=\"The Back to Top \u2191 button allows users to quickly return to the top of the page with a single click, improving navigation and experience\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Simple Scroll Back to Top of the Page Button JavaScript\" \/>\n<meta property=\"og:description\" content=\"The Back to Top \u2191 button allows users to quickly return to the top of the page with a single click, improving navigation and experience\" \/>\n<meta property=\"og:url\" content=\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"HTML Online\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/htmlcoding\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-28T08:58:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-01T10:11:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2024\/07\/back-to-top-progress-indicator-rubiks-cube.jpg\" \/>\n<meta name=\"author\" content=\"HTML Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"HTML Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/\"},\"author\":{\"name\":\"HTML Editor\",\"@id\":\"https:\/\/html-online.com\/articles\/#\/schema\/person\/019f9afa07f209153df0fecfc90b8c1d\"},\"headline\":\"Scroll Back to Top Button With Progress Bar Indicator\",\"datePublished\":\"2026-02-28T08:58:00+00:00\",\"dateModified\":\"2026-03-01T10:11:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/\"},\"wordCount\":583,\"publisher\":{\"@id\":\"https:\/\/html-online.com\/articles\/#organization\"},\"image\":{\"@id\":\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2024\/07\/back-to-top-progress-indicator-rubiks-cube.jpg\",\"articleSection\":[\"CSS\",\"Freebies\",\"HTML\",\"JavaScript\",\"jQuery\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/\",\"url\":\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/\",\"name\":\"Simple Scroll Back to Top of the Page Button JavaScript\",\"isPartOf\":{\"@id\":\"https:\/\/html-online.com\/articles\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2024\/07\/back-to-top-progress-indicator-rubiks-cube.jpg\",\"datePublished\":\"2026-02-28T08:58:00+00:00\",\"dateModified\":\"2026-03-01T10:11:16+00:00\",\"description\":\"The Back to Top \u2191 button allows users to quickly return to the top of the page with a single click, improving navigation and experience\",\"breadcrumb\":{\"@id\":\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#primaryimage\",\"url\":\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2024\/07\/back-to-top-progress-indicator-rubiks-cube.jpg\",\"contentUrl\":\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2024\/07\/back-to-top-progress-indicator-rubiks-cube.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/html-online.com\/articles\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Scroll Back to Top Button With Progress Bar Indicator\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/html-online.com\/articles\/#website\",\"url\":\"https:\/\/html-online.com\/articles\/\",\"name\":\"HTML Online Articles\",\"description\":\"Tips, tricks, tutorials\u2026\",\"publisher\":{\"@id\":\"https:\/\/html-online.com\/articles\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/html-online.com\/articles\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/html-online.com\/articles\/#organization\",\"name\":\"HTML Online\",\"url\":\"https:\/\/html-online.com\/articles\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/html-online.com\/articles\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2022\/06\/logo.jpg\",\"contentUrl\":\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2022\/06\/logo.jpg\",\"width\":350,\"height\":350,\"caption\":\"HTML Online\"},\"image\":{\"@id\":\"https:\/\/html-online.com\/articles\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/htmlcoding\/\",\"https:\/\/www.linkedin.com\/in\/ferencdenes\/\",\"https:\/\/www.youtube.com\/channel\/UCn38Jw1sJzbjVHO95Zp0Sww\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/html-online.com\/articles\/#\/schema\/person\/019f9afa07f209153df0fecfc90b8c1d\",\"name\":\"HTML Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/html-online.com\/articles\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7c1d8f5e7f1dc3e261766a96ac50c6a907fa5c236e87ab73379c57c9114e92cd?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7c1d8f5e7f1dc3e261766a96ac50c6a907fa5c236e87ab73379c57c9114e92cd?s=96&d=mm&r=g\",\"caption\":\"HTML Editor\"},\"description\":\"In 2013, while wrestling with a mountain of client articles and an uncooperative CMS, I decided enough was enough. So, I created an online HTML editor purely out of necessity (and mild frustration). What began as a tool for my own sanity quickly evolved into a gift for the world\u2014or at least for anyone trying to avoid breaking their website's code. Since then, I've shared my tech notes on my blog, which serves as both a handy reference and a digital diary of the adventures and misadventures of a coder.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/ferencdenes\/\",\"https:\/\/www.youtube.com\/@htmlg\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Simple Scroll Back to Top of the Page Button JavaScript","description":"The Back to Top \u2191 button allows users to quickly return to the top of the page with a single click, improving navigation and experience","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/","og_locale":"en_GB","og_type":"article","og_title":"Simple Scroll Back to Top of the Page Button JavaScript","og_description":"The Back to Top \u2191 button allows users to quickly return to the top of the page with a single click, improving navigation and experience","og_url":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/","og_site_name":"HTML Online","article_publisher":"https:\/\/www.facebook.com\/htmlcoding\/","article_published_time":"2026-02-28T08:58:00+00:00","article_modified_time":"2026-03-01T10:11:16+00:00","og_image":[{"url":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2024\/07\/back-to-top-progress-indicator-rubiks-cube.jpg","type":"","width":"","height":""}],"author":"HTML Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"HTML Editor","Estimated reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#article","isPartOf":{"@id":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/"},"author":{"name":"HTML Editor","@id":"https:\/\/html-online.com\/articles\/#\/schema\/person\/019f9afa07f209153df0fecfc90b8c1d"},"headline":"Scroll Back to Top Button With Progress Bar Indicator","datePublished":"2026-02-28T08:58:00+00:00","dateModified":"2026-03-01T10:11:16+00:00","mainEntityOfPage":{"@id":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/"},"wordCount":583,"publisher":{"@id":"https:\/\/html-online.com\/articles\/#organization"},"image":{"@id":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2024\/07\/back-to-top-progress-indicator-rubiks-cube.jpg","articleSection":["CSS","Freebies","HTML","JavaScript","jQuery"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/","url":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/","name":"Simple Scroll Back to Top of the Page Button JavaScript","isPartOf":{"@id":"https:\/\/html-online.com\/articles\/#website"},"primaryImageOfPage":{"@id":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#primaryimage"},"image":{"@id":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2024\/07\/back-to-top-progress-indicator-rubiks-cube.jpg","datePublished":"2026-02-28T08:58:00+00:00","dateModified":"2026-03-01T10:11:16+00:00","description":"The Back to Top \u2191 button allows users to quickly return to the top of the page with a single click, improving navigation and experience","breadcrumb":{"@id":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#primaryimage","url":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2024\/07\/back-to-top-progress-indicator-rubiks-cube.jpg","contentUrl":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2024\/07\/back-to-top-progress-indicator-rubiks-cube.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/html-online.com\/articles\/dynamic-scroll-back-top-page-button-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/html-online.com\/articles\/"},{"@type":"ListItem","position":2,"name":"Scroll Back to Top Button With Progress Bar Indicator"}]},{"@type":"WebSite","@id":"https:\/\/html-online.com\/articles\/#website","url":"https:\/\/html-online.com\/articles\/","name":"HTML Online Articles","description":"Tips, tricks, tutorials\u2026","publisher":{"@id":"https:\/\/html-online.com\/articles\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/html-online.com\/articles\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/html-online.com\/articles\/#organization","name":"HTML Online","url":"https:\/\/html-online.com\/articles\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/html-online.com\/articles\/#\/schema\/logo\/image\/","url":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2022\/06\/logo.jpg","contentUrl":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2022\/06\/logo.jpg","width":350,"height":350,"caption":"HTML Online"},"image":{"@id":"https:\/\/html-online.com\/articles\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/htmlcoding\/","https:\/\/www.linkedin.com\/in\/ferencdenes\/","https:\/\/www.youtube.com\/channel\/UCn38Jw1sJzbjVHO95Zp0Sww"]},{"@type":"Person","@id":"https:\/\/html-online.com\/articles\/#\/schema\/person\/019f9afa07f209153df0fecfc90b8c1d","name":"HTML Editor","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/html-online.com\/articles\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7c1d8f5e7f1dc3e261766a96ac50c6a907fa5c236e87ab73379c57c9114e92cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7c1d8f5e7f1dc3e261766a96ac50c6a907fa5c236e87ab73379c57c9114e92cd?s=96&d=mm&r=g","caption":"HTML Editor"},"description":"In 2013, while wrestling with a mountain of client articles and an uncooperative CMS, I decided enough was enough. So, I created an online HTML editor purely out of necessity (and mild frustration). What began as a tool for my own sanity quickly evolved into a gift for the world\u2014or at least for anyone trying to avoid breaking their website's code. Since then, I've shared my tech notes on my blog, which serves as both a handy reference and a digital diary of the adventures and misadventures of a coder.","sameAs":["https:\/\/www.linkedin.com\/in\/ferencdenes\/","https:\/\/www.youtube.com\/@htmlg"]}]}},"_links":{"self":[{"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/posts\/55","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/comments?post=55"}],"version-history":[{"count":3,"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/posts\/55\/revisions"}],"predecessor-version":[{"id":2547,"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/posts\/55\/revisions\/2547"}],"wp:attachment":[{"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/media?parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/categories?post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/tags?post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}