Sha256: d6041329dc2c3e2296cdd2ba001341a1ea0926ade5c10e2cebefb11818a0588a

Contents?: true

Size: 1.23 KB

Versions: 12

Compression:

Stored size: 1.23 KB

Contents

/*
 * Interaction demos for the <progress> polyfill
 * Demonstrates setting the progress value through Javascript
 * @author Espen Hovlandsdal http://rexxars.com
 */
(function(d) {
    var bind = function(el, event, fn) {
        if (el.addEventListener) {
            el.addEventListener(event, fn, false);
        } else {
            el.attachEvent('on' + event, fn)
        }
    };

    var dyn  = d.getElementById('dynamicProgress'), timer, progress = 0;
    var el   = dyn.getElementsByTagName('progress')[0];
    var perc = dyn.getElementsByClassName('percentage')[0];

    var progressTo = function(to) {
        clearInterval(timer);
        var inc = to < el.value ? -1 : 1;

        timer = setInterval(function() {
            progress += inc;
            el.value = progress;

            perc.innerHTML = progress;

            if (progress == to) {
                return clearInterval(timer);
            }
        }, 25);
    };

    bind(d.getElementById('animateFully'), 'click', function() {
        progressTo(100);
    });

    bind(d.getElementById('animateToUserInput'), 'click', function() {
        var to = parseInt(prompt('How many percent?', 50), 10);
        progressTo(Math.max(0, Math.min(100, to)));
    });

})(document);

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
jekyll-octopod-0.7.0 assets/podlove-web-player/js/vendor/user-interaction.js
jekyll-octopod-0.6.7 assets/podlove-web-player/js/vendor/user-interaction.js
jekyll-octopod-0.6.6 assets/podlove-web-player/js/vendor/user-interaction.js
jekyll-octopod-0.6.5 assets/podlove-web-player/js/vendor/user-interaction.js
jekyll-octopod-0.6.4 assets/podlove-web-player/js/vendor/user-interaction.js
jekyll-octopod-0.6.3 assets/podlove-web-player/js/vendor/user-interaction.js
jekyll-octopod-0.6.2 assets/podlove-web-player/js/vendor/user-interaction.js
jekyll-octopod-0.6.1 assets/podlove-web-player/js/vendor/user-interaction.js
jekyll-octopod-0.6.0 assets/podlove-web-player/js/vendor/user-interaction.js
jekyll-octopod-0.5.3 assets/podlove-web-player/js/vendor/user-interaction.js
jekyll-octopod-0.5.1 assets/podlove-web-player/js/vendor/user-interaction.js
jekyll-octopod-0.5.0 assets/podlove-web-player/js/vendor/user-interaction.js