A self-contained, customizable loading indicator with falling bubble animations. Everything is packaged in a single JavaScript file with no external dependencies or CSS files needed.
Two versions available:
• bubz.js (10 KB) - Readable source for development and debugging
• bubz.min.js (5.8 KB) - Minified version for production use
Links:
• View Standalone Demo (single example vs. feature demos below)
• GitHub Repository
• CDN: https://cdn.jsdelivr.net/gh/ThreeBit-Media/bubz@main/bubz.min.js
Simply include the script and add the custom element:
<!-- For development --> <script src="bubz.js"></script> <!-- For production (recommended) --> <script src="bubz.min.js"></script> <bubz-indicator></bubz-indicator>
Change the text using the text attribute:
<bubz-indicator text="WAIT"></bubz-indicator>
Change colors using the color attribute:
<bubz-indicator text="PROCESSING" color="#4CAF50"></bubz-indicator>
Adjust size using the size attribute (default is 1):
<bubz-indicator text="SMALL" size="0.6"></bubz-indicator> <bubz-indicator text="LARGE" size="1.5"></bubz-indicator>
Adjust animation speed using the speed attribute (higher = slower):
<bubz-indicator text="FAST" speed="0.5" color="#FF5722"></bubz-indicator>
Control visibility programmatically using .show() and .hide() methods:
// Instantiate like this in the HTML:
// <bubz-indicator id="controlled-loader" text="CONTROL ME" color="#2196F3"></bubz-indicator>
//
// Then in a <script> ...
const loader = document.querySelector('#controlled-loader');
loader.hide(); // Hide with fade out
loader.show(); // Show with fade in
// With callbacks
loader.hide(() => console.log('Hidden!'));
loader.show(() => console.log('Visible!'));
Change properties at runtime:
const loader = document.querySelector('#dynamic-loader');
loader.text = 'NEW TEXT';
loader.color = '#FF9800';
loader.size = 1.2;
You can have multiple loaders on the same page with different configurations:
Create a full-page loading overlay:
<div id="overlay" style="position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: none; z-index: 9999;"> <bubz-indicator text="LOADING" color="#fff"></bubz-indicator> </div>
| Attribute | Type | Default | Description |
|---|---|---|---|
text |
String | "LOADING" | The text to display |
color |
String | "#777" | Base color (hex format) |
size |
Number | 1 | Size multiplier |
speed |
Number | 1 | Speed multiplier (higher = slower) |
show(callback) - Show the indicator with fade-in effecthide(callback) - Hide the indicator with fade-out effectisVisible() - Returns true if visibleAll attributes can also be accessed as JavaScript properties:
loader.text = "NEW TEXT"; loader.color = "#FF0000"; loader.size = 1.5; loader.speed = 0.8;