| Type: | Status Widget |
| Tag used: | div, class='progress' |
| Attributes: | value, animate |
| Description: |
A dead-simple progress bar, that is controlled using its 'value' property. The div tag is not replaced in this custom element, but instead is used as a container.
For an animated effect, use a stylesheet to set the background of div.pctvalue to a repeating-pattern image, and set the progress bar's animation to '1'. The script will animate the image using a 4-wave lisajous movement. Note: if you want to use multiple styles of progress bar, avoid styling the 'progress' class, instead opting for custom names. In this way, you can use different styles for 'pctvalue' by subclassing As with all of my widgets, the idea here is that you can just <script> include the .js file and start dropping in tags without needing to know any ECMAScript at all. Additionally, for you ECMAScripters, I was very careful to keep my pollution of the global namespace to one class: progressBar. Also, there are javascript bindings: progressbar.adjust(signed integer)Allows you to increase or decrease the progress bar's value progressbar.set(unsigned integer) Allows you to set the progressbar's value The standard 'setAttribute' and 'getAttribute' functions work as well, but these are provided as shortcuts. |
| Example: |
<style>
/* example skin for progress bar */ .minibar { background-color: black; height: 8px; width: 100px; } .minibar .pctvalue { background-image: url("images/blueness.png"); } </style> ... <div class="progress" value='50' animate=yes> </div> <style> /* another example skin for progress bar */ .normal { background-color: black; height: 8px; width: 100px; } .normal .pctvalue { background-image: url("images/redness.png"); } </style> ... <div class="progress normal" value='50' animate=yes> </div> |
| Download: | progress.js (1.99k) |