(container, progress, speed)
| 7668 | * @param {Object} speed 进度条动画时间 |
| 7669 | */ |
| 7670 | var setProgressbar = function(container, progress, speed) { |
| 7671 | if (typeof container === 'number') { |
| 7672 | speed = progress; |
| 7673 | progress = container; |
| 7674 | container = false; |
| 7675 | } |
| 7676 | var progressbar = _findProgressbar(container); |
| 7677 | if (!progressbar || progressbar.classList.contains(CLASS_PROGRESSBAR_INFINITE)) { |
| 7678 | return; |
| 7679 | } |
| 7680 | if (progress) progress = Math.min(Math.max(progress, 0), 100); |
| 7681 | progressbar.offsetHeight; |
| 7682 | var span = progressbar.querySelector('span'); |
| 7683 | if (span) { |
| 7684 | var style = span.style; |
| 7685 | style.webkitTransform = 'translate3d(' + (-100 + progress) + '%,0,0)'; |
| 7686 | if (typeof speed !== 'undefined') { |
| 7687 | style.webkitTransitionDuration = speed + 'ms'; |
| 7688 | } else { |
| 7689 | style.webkitTransitionDuration = ''; |
| 7690 | } |
| 7691 | } |
| 7692 | return progressbar; |
| 7693 | }; |
| 7694 | $.fn.progressbar = function(options) { |
| 7695 | var progressbarApis = []; |
| 7696 | options = options || {}; |
no test coverage detected