-
-
- Add a View as Markdown Link to Joomla Articles
- Display the Last Modified Date in Joomla Articles
- Embed Iframes in Joomla
- Automatically Link Twitter (X) @mentions in Joomla Articles
- Open External Links in a New Tab in Joomla
- Display Estimated Reading Time in Joomla Articles
- Replace Old URLs in Joomla
- Search and Replace in Joomla
-
- Make the Administrator Navigation Sticky in Joomla
- Add Google Fonts to Joomla
- Add a Facebook Messenger Chat Button to Joomla
- Add a Reading Progress Bar to Joomla
- Add a Custom Scrollbar to Joomla
- Show Confetti on a Thank You Page in Joomla
- Add Smooth Scrolling to Joomla
- Add a Back to Top Button in Joomla
- Add a WhatsApp Chat Button in Joomla
-
- Assign New Users to a Different User Group Automatically in Joomla
- Redirect Visitors by Country in Joomla
- Redirect Users After Login by User Group in Joomla
- Block User Registration with Certain Usernames in Joomla
- Block User Registration by Country in Joomla
- Block User Registration by Email Address in Joomla
- Block User Registration by IP Address in Joomla
- Remove the Forgot Password and Username Links in Joomla
- Remove the Generator Meta Tag in Joomla
- Let Users Log In with Their Email Address in Joomla
- Block Traffic by Country in Joomla
- Block Bot Traffic in Joomla
- Block Traffic by IP Address in Joomla
Add a Back to Top Button in Joomla
Help readers get back to the top of long Joomla pages in one click with a floating back to top button, using one HTML snippet.
Long articles, category listings, and documentation pages leave readers stranded at the bottom, scrolling for several seconds just to reach your menu again. On mobile that is enough friction to make them close the tab instead. A back to top button in Joomla solves it with one small floating control, and you don't need a plugin or a template override to add one. You can add a back to top button to your Joomla site using Code Snippets.
The Snippet Code
This single HTML snippet contains everything the button needs: the markup, its styling, and the script that shows it after the visitor scrolls down. It appears once the page is scrolled 300 pixels, scrolls smoothly back to the top when clicked, and stays out of the way otherwise.
<button id="tcs-back-to-top" type="button" aria-label="Back to top">↑</button>
<style>
#tcs-back-to-top {
position: fixed;
right: 20px;
bottom: 20px;
z-index: 999;
display: none;
width: 44px;
height: 44px;
border: 0;
border-radius: 50%;
background: #111827;
color: #fff;
font-size: 20px;
line-height: 44px;
cursor: pointer;
box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
#tcs-back-to-top:hover {
opacity: .85;
}
</style>
<script>
(function () {
var button = document.getElementById('tcs-back-to-top');
if (!button) {
return;
}
window.addEventListener('scroll', function () {
button.style.display = window.scrollY > 300 ? 'block' : 'none';
});
button.addEventListener('click', function () {
window.scrollTo({ top: 0, behavior: 'smooth' });
});
})();
</script>
To move the button to the left, swap right: 20px for left: 20px. To match your brand, change the background colour.
How to add this snippet
- Install Code Snippets if it is not installed already.
- Go to Joomla Administrator.
- Open Components → Code Snippets.
- Click New.
- Give your snippet a descriptive title like "Back to Top Button".
- Select HTML snippet type.
- Paste the back to top button code above.
- Select Site Footer as the "Insertion Method".
- Publish the snippet.
- Optionally, open the Conditional Logic tab to show the button only on long pages such as articles or blog views. Leave it empty to run it site-wide. Learn more in Using Conditional Logic.
Congrats! You've successfully added a back to top button to your Joomla site without installing another plugin.