0
간단한 진행 위젯을 만들려고합니다. 그러나 나는 _showProgress
을 몇 번이고 반복해서 오류가 발생하지 않습니다.jQuery UI 위젯이 동봉 된 함수를 찾을 수 없습니다.
(function ($, undefined) {
$.widget("AOne.ProgressBar", {
options: { max: 100, min: 0, current: 0, time: 1000, stepWidth: 1 },
innerDiv: $("<div></div>").css({ overflow: 'hidden', clear: 'both',
height: '10px', width: '0px',
background: 'transparent url("Progress.gif") repeat-x
scroll left center' }).html(" "),
_create: function() {
this.element.append(this.innerDiv);
maxWidth = this.element.outerWidth();
this.options.stepWidth = maxWidth/this.options.max;
},
_init: function() {
this.intervalId = setInterval(function() {
this._showProgress();
},
this.options.time);
},
_showProgress: function() {
this.options.current += 1;
if (this.options.current < this.options.max) {
this.innerDiv.css({ width: this.options.stepWidth *
this.options.current + 'px' });
} else {
window.clearInterval(this.intervalId);
}
},
_setOption: function (key, value) {
$.Widget.prototype._setOption.apply(this, arguments);
},
destroy: function() {
$.Widget.prototype.destroy.call(this);
}
});
})(jQuery);
이걸로 2 시간을 낭비했습니다. 너 락! – TheVillageIdiot