Weebly Tricks #84 — ClassyCountdown Timer
Add a clean countdown timer to your Weebly site, created by Marius Stanciu.
Learn how to customize and modify your Weebly site with new effects, plugins, and widgets.
Welcome to My Weebly Tricks, a resource for Weebly site owners who want to go beyond the basics. Here you'll find step-by-step guides on adding image effects, slideshows, navigation scripts, text animations, countdown timers, and more — all tailored for the Weebly platform.
A reading progress bar shows visitors how far they have travelled through a blog post. As someone scrolls, a slim coloured line moves across the top of the screen, giving a visual estimate of the remaining article. It is a small interface feature, yet it can make long guides, reviews and tutorials feel easier to approach.
Weebly does not include a built-in reading progress indicator for blog posts, but you can add one with a small combination of HTML, CSS and JavaScript. The method below works with a standard Weebly theme, adapts to mobile screens and can be adjusted to match an Australian blog’s branding, whether your readers are browsing during a Sydney commute or relaxing in Perth after work.
A reading progress bar should support the page rather than compete with the title, navigation or advertising. A height of 4 to 6 pixels is usually enough. Bright colours can work for lifestyle blogs, while a darker brand colour may be more suitable for business, education or professional websites.
The bar normally sits at the top of the browser window and remains visible as the visitor scrolls. Its width begins at zero and reaches 100 per cent when the reader arrives at the end of the article. The script should measure the article itself rather than the entire page, because a Weebly page may also contain a header, sidebar, related posts and footer.
Before editing your site, save a copy of the current theme or record any existing custom code. Weebly’s editor can place code in several locations, and a misplaced closing tag can affect every page using that theme. If you have already customised your header, a guide to a retina logo setup can help you keep branding sharp while working on the same area.
For a blog-wide progress bar, open Weebly and go to Theme, Edit HTML/CSS, then select the relevant layout file. Many themes use files such as header.html, blog-post.html or a similar page template. Add the bar markup immediately after the opening <body> tag if you want it available throughout the site, or place it in the individual blog-post template if it should appear only on articles.
The CSS can go in the theme’s stylesheet, commonly named main.less, style.css or something similar. Weebly themes vary, so use the existing file structure rather than creating several competing style blocks. If the editor does not expose a suitable template, you can place a code element on a page, although that approach may require repeating the element on each post.
Use a distinctive class name such as mwt-reading-progress to reduce the chance of conflict with theme styles. Avoid generic names like .progress, because a theme or embedded widget may already use them for a loading animation, donation meter or image gallery.
Insert this HTML near the opening body tag:
<div class="mwt-reading-progress" aria-hidden="true">
<span class="mwt-reading-progress-bar"></span>
</div>
The aria-hidden attribute keeps the decorative line out of the screen reader’s reading order. It does not hide the article or alter the page’s useful content.
Add the following CSS to your theme stylesheet:
.mwt-reading-progress {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 5px;
z-index: 9999;
background: transparent;
pointer-events: none;
}
.mwt-reading-progress-bar {
display: block;
width: 0;
height: 100%;
background: #d35400;
transform-origin: left center;
transition: width 0.08s linear;
}
The orange colour suits an energetic editorial site, but you can replace #d35400 with a colour from your own palette. Australian websites often use strong contrasts for outdoor, travel and local-business branding, although a colour should still be tested against the background and checked for sufficient contrast.
A fixed position keeps the indicator visible while the visitor reads. The high z-index places it above most theme elements, while pointer-events: none means it cannot block clicks on a menu, search icon or banner. If your site has a sticky header, test the bar with that header enabled. You may prefer to set top: 56px or another value if the progress line should sit beneath the navigation.
Keep the effect light on mobile connections. Visitors in regional New South Wales, Queensland or Western Australia may have a less consistent connection than people on fast fibre services in Melbourne or Sydney. The progress bar itself uses almost no bandwidth, but excessive animation and extra scripts can still make a page feel slow.
Place this JavaScript just before the closing </body> tag, or in Weebly’s footer code area if that code is loaded on the blog post:
<script>
(function () {
function updateReadingProgress() {
var article = document.querySelector('.blog-post, .blog-content, article');
var bar = document.querySelector('.mwt-reading-progress-bar');
if (!article || !bar) return;
var articleTop = article.getBoundingClientRect().top + window.pageYOffset;
var articleHeight = article.offsetHeight;
var scrollPosition = window.pageYOffset;
var viewportHeight = window.innerHeight;
var readableDistance = articleHeight - viewportHeight;
var progress = ((scrollPosition - articleTop) / readableDistance) * 100;
progress = Math.min(100, Math.max(0, progress));
bar.style.width = progress + '%';
}
window.addEventListener('scroll', updateReadingProgress, { passive: true });
window.addEventListener('resize', updateReadingProgress);
window.addEventListener('load', updateReadingProgress);
})();
</script>
The selector is the part most likely to require adjustment. Weebly themes can give the main post area different class names, so inspect a published article in your browser. Right-click inside the article, choose Inspect, and look for the element containing the post title and body. Replace .blog-post, .blog-content, article with the correct class if the bar stays at zero or fills too quickly.
The calculation subtracts the viewport height from the article height. This means the bar reaches 100 per cent when the bottom of the article becomes visible, rather than waiting until the visitor has scrolled through the footer. If a post is shorter than the screen, the mathematical distance may be zero or negative. You can make the script safer by adding this line after var readableDistance:
if (readableDistance <= 0) {
bar.style.width = '100%';
return;
}
Check the result on a laptop, tablet and phone before publishing it across your blog. Mobile reading is common during train trips in Sydney and Melbourne, on breaks in Brisbane offices and at home on smaller screens. A five-pixel line should remain visible without taking valuable space from a compact phone display.
Test a short post, a long post, a post with images and a post with embedded video. Images that load after the initial page render can change the article height, which may cause the indicator to move unexpectedly. The basic script recalculates when the window changes size, but lazy-loaded media can still affect its accuracy. Adding dimensions to images in the Weebly editor helps the browser reserve space and reduces layout movement.
Use these quick checks when reviewing the feature:
Also review keyboard and screen-reader behaviour. The bar is decorative, so it should never be the only way to understand where a reader is in the article. Use descriptive headings, short paragraphs and meaningful link text to provide a useful structure for everyone.
A scroll listener with the passive option is a sensible starting point, but very long pages can still trigger frequent visual updates. If the browser appears sluggish, use requestAnimationFrame to group updates. Most ordinary Weebly posts will work well with the simpler version, particularly when the page has modest image sizes and limited third-party advertising.
The feature does not need visitor names, email addresses or reading histories. Avoid connecting it to analytics unless you have a clear reason. If you add tracking that records scroll depth, review your privacy notice and consider obligations under Australia’s Privacy Act and the Australian Privacy Principles. A visual indicator that runs locally is generally less intrusive than a script that sends detailed behaviour data to an external service.
A progress bar does not improve search ranking by itself. Search engines still value useful content, logical headings, mobile performance and accurate page titles. For a book review, tutorial or local business guide, state the practical benefit early and keep the article focused. Readers browsing an Australian book site such as Bair Books are likely to care more about clear reviews and easy navigation than a decorative animation.
Do not place the progress bar inside the post title, excerpt or structured data. Keep the article text available as normal HTML, and make sure the visible page remains complete if the script fails. This protects visitors using strict browser settings and prevents a small enhancement from becoming a content problem.
If nothing appears, check that the HTML, CSS and JavaScript were added to the same published theme. Weebly can show changes in the editor preview before they are visible on the live domain, so publish the site and clear the browser cache. An ad blocker or privacy extension can also hide scripts, although it should not remove the article itself.
If the bar is visible but never moves, inspect the article selector first. If it moves too quickly, the selector may be targeting a wrapper that includes only the visible text or excludes images. If it begins halfway across the screen, an existing theme rule may be applying a width, margin or transform to the span. Add width: 0 !important; temporarily to identify that conflict, then remove the declaration if it is no longer needed.
A common separate issue is a mobile navigation overlay covering the top of the page. Resolve that before judging the progress bar, since the two fixed elements can compete for space. The troubleshooting guide on fixing Weebly mobile menus covers a related theme problem and can help restore predictable behaviour on smaller screens.
Finally, test the published URL in Chrome, Safari and Firefox, including an iPhone or Android device. Check the page in portrait and landscape orientation, then review it after changing the site header or adding a new widget. Once the bar has been verified, save the final code in a text file with the theme name and date so it can be restored after a future Weebly redesign.
Add the code to a duplicate or carefully backed-up theme, publish a sample post, and watch the indicator through the full article. A well-tested reading progress bar gives visitors a clear sense of place while keeping your Weebly blog fast, accessible and comfortable to read.
Add a clean countdown timer to your Weebly site, created by Marius Stanciu.
A comparison of free and paid email accounts and the advantages of using a domain-based custom email.
Instructions on setting a free custom email address for your website within Weebly.
Configure your Weebly RSS feed so visitors can subscribe and receive email updates.
Details on a promotional offer for two months of free email hosting from Namecheap.
Subscribe for regular email updates and get access to new Weebly tips and tutorials.