<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        基于jquery的一個progressbarwidge_jquery

        來源:懂視網(wǎng) 責編:小采 時間:2020-11-27 20:55:29
        文檔

        基于jquery的一個progressbarwidge_jquery

        基于jquery的一個progressbarwidge_jquery:此項目的demo網(wǎng)站http://wijmo.com/Wijmo-Open/samples/ 代碼如下: /* * wijprogressbar Widget. V1.0 * * Copyright (c) Componentone Inc. * * Depends: * Jquery-1.4.2.js * jquery.ui.core.js *
        推薦度:
        導讀基于jquery的一個progressbarwidge_jquery:此項目的demo網(wǎng)站http://wijmo.com/Wijmo-Open/samples/ 代碼如下: /* * wijprogressbar Widget. V1.0 * * Copyright (c) Componentone Inc. * * Depends: * Jquery-1.4.2.js * jquery.ui.core.js *

        此項目的demo網(wǎng)站http://wijmo.com/Wijmo-Open/samples/
        代碼如下:
        /*
        * wijprogressbar Widget. V1.0
        *
        * Copyright (c) Componentone Inc.
        *
        * Depends:
        * Jquery-1.4.2.js
        * jquery.ui.core.js
        * jquery.ui.widget.js
        *
        *Optional dependence for effect settings:
        * jquery.effects.core.js
        * jquery.effects.blind.js
        * jquery.effects.bounce.js
        * jquery.effects.clip.js
        * jquery.effects.drop.js
        * jquery.effects.explode.js
        * jquery.effects.fold.js
        * jquery.effects.hightlight.js
        * jquery.effects.pulsate.js
        * jquery.effects.scale.js
        * jquery.effects.shake.js
        * jquery.effects.slide.js
        * jquery.effects.transfer.js
        * HTML:
        *
        */
        (function ($) {
        $.widget("ui.wijprogressbar", $.ui.progressbar, {
        options: {
        ///
        ///The label's alignment on the progress bar. The value should be "east", "west", "center", "north", "south" or "running".
        ///Default:"center".
        ///Type:String.
        ///Code sample:$('.selector').wijprogressbar('option','labelAlign','center').
        ///

        labelAlign: "center",
        ///
        ///The value of the progress bar,the type should be numeric.
        ///Default:0.
        ///Type:Number.
        ///Code sample:$('.selector').wijprogressbar('option','value',60).
        ///

        maxValue: 100,
        ///
        ///The minimum value of the progress bar,the type should be numeric.
        ///Default:0.
        ///Type:Number.
        ///Code sample:$('.selector').wijprogressbar('option','minValue',0).
        ///

        minValue: 0,
        ///
        ///The fill direction of the progress bar.the value should be "east", "west", "north" or "south".
        ///Default:"east".
        ///Type:String.
        ///Code sample:$('.selector').wijprogressbar('option','fillDirection','east').
        ///

        fillDirection: "east",
        ///
        ///The progressbar's orientation.the value should be 'horizontal' or 'vertical'.
        ///Default:"horizontal".
        ///Type:String.
        ///Code sample:$('selector').wijprogressbar('option','orientation','horizontal').
        ///

        ///orientation: "horizontal",
        ///
        ///Sets the format of the label text.The available formats are as follows:
        ///{0} or {ProgressValue} express the current progress Value.
        ///{1} or {PercentProgress} express the current percent of the progress bar.
        ///{2} or {RemainingProgress} express the remaining progress of the progress bar.
        ///{3} or {PercentageRemaining} express the remaining percent of the progress bar.
        ///{4} or {Min} express the min Vlaue of the progress bar.
        ///{5} or {Max} express the max Value of the progress bar.
        ///Default:"{1}%".
        ///Type:String.
        ///Code sample:$('.selector').wijprogressbar('option','labelFormatString','{0}%').
        ///

        labelFormatString: "{1}%",
        ///
        ///Set the format of the ToolTip of the progress bar,the expression of the format like the labelFormatString.
        ///Default:"{1}%".
        ///Type:String.
        ///Code sample:$('.selector').wijprogressbar('option','toolTipFormatString','{1}%').
        ///

        toolTipFormatString: "{1}%",
        ///
        ///The increment of the progress bar's indicator.
        ///Default:1.
        ///Type:Number.
        ///

        ///Code sample:$('.selector').wijprogressbar('option','indicatorIncrement',10).
        indicatorIncrement: 1,
        ///
        ///The Image's url of the indicator.
        ///Default:"".
        ///Type:String.
        ///Code sample:$('.selector').wijprogressbar('option','indicatorImage','images/abc.png').
        ///

        indicatorImage: "",
        ///
        ///The delay of the progressbar's animation.
        ///Default:0.
        ///Type:Number.
        ///Code sample:$('.selector').wijprogressbar('option',
        ///

        animationDelay: 0,
        ///
        ///The options parameter of the jQuery's animation.
        ///Default:"{animated:'progress',duration:500}".
        ///Type:Options.
        ///Code sample:$('.selector').wijprogressbar('option','animationOptions',{animated:'progress',duration:600}).
        ///

        animationOptions: {
        animated: 'progress',
        duration: 500
        }
        },
             //when set the options, trigger this method.
        _setOption: function (key, value) {
        var val, self = this;
        switch (key) {
        case "value":
        val = parseInt(value);
        self.options[key] = val;
        self._refreshValue(val);
        break;
        case "maxValue":
        case "minValue":
        val = parseInt(value);
        self.options[key] = val;
        self[key === "maxValue" ? "max" : "min"] = val;
        self._refreshValue();
        break;
        case "labelFormatString":
        case "toolTipFormatString":
        self.options[key] = value;
        self._refreshValue();
        //$.Widget.prototype._setOption.apply(this, arguments);
        break;
        case "orientation":
        case "fillDirection":
        case "labelAlign":
        case "indicatorImage":
        self.options[key] = value;
        self._initElements();
        self._refreshValue();
        //$.Widget.prototype._setOption.apply(this, arguments);
        break;
        case "indicatorIncrement":
        value = (value == 0 ? 1 : value);
        self.options[key] = value;
        self._initElements();
        self._refreshValue();
        break;
        default: break;
        }
        $.Widget.prototype._setOption.apply(self, arguments);
        },
             ///create the widget
        _create: function () {
        var self = this;
        self.min = self.options.minValue;
        self.max = self.options.maxValue;
        self.element.addClass("ui-wijprogressbar");
        $.ui.progressbar.prototype._create.apply(self, arguments);
        self.label = $("").addClass("ui-progressbar-label ui-corner-left").appendTo(self.valueDiv);
        self._initElements();
        self._isInit = true;
        self._refreshValue();
        },
             ///Trigger the pressbar event.
        _triggerEvent: function (eventName, oldValue, newValue, cancel) {
        var ea = $.Event(eventName);
        ea.data = {
        oldValue: oldValue,
        newValue: newValue,
        cancel: cancel
        };
        this._trigger(eventName, ea);
        return ea.data.cancel;
        },
            //refresh the progress value.
        _refreshValue: function () {
        var self = this;
        if (!self._isInit) {
        return;
        }
        var value = self.value();
        var percent = (value - self.min) / (self.max - self.min) * 100;
        var o = self.options;

        var cancel = self._triggerEvent("beforeProgressChanging", self.element.attr("aria-valuenow"), value, false);
        if (cancel) {
        return;
        }
        self.valueDiv.css({
        width: "",
        height: ""
        });
                  // If have animation.
        if (o.animationOptions.animated && o.animationOptions.duration > 0) {
        setTimeout($.proxy(function () {
        var o = self.options.animationOptions;
        var animateOptions = {
        content: self.valueDiv,
        complete: $.proxy(function () {
        self._triggerEvent("progressChanged", self.element.attr("aria-valuenow"), value, false);
        }, self),
        step: $.proxy(function (ovalue) {
        self._performAnimating(ovalue);
        }, self),
        processValue: percent
        }
        var animations = $.ui.wijprogressbar.animations;
        var duration = o.duration;
        var easing = o.animated;
        if (easing && !animations[easing]) {
        easing = "progress";
        }
        if (!animations[easing]) {
        animations[easing] = function (options) {
        this.progress(options, {
        easing: easing,
        duration: duration || 1000
        });
        }
        }
        animations[easing](animateOptions, self.options.animationOptions);

        }, self), o.animationDelay);
        }
        else {
        //trigger the progressChanged event.
        var oldValue = self.element.attr("aria-valuenow");
        self._refreshProgress(percent);
        self._triggerEvent("progressChanged", oldValue, value, false);
        }
        },
               ///Set the label's position of the progress bar.
        _setLabelSide: function () {
        var self = this;
        var fillDirection = self.options.fillDirection;
        var labelAlign = self.options.labelAlign;
        if (self._isHorizontal()) {
        if (labelAlign === "west" || labelAlign === "east" || labelAlign === "center") {
        self.label.css("width", self.element.width() + 'px');
        }
        else
        if (labelAlign === "running") {
        self.label.css("width", "auto");
        }
        else {
        self.element.css("line-height", "normal");
        self.valueDiv.css("line-height", "normal");
        self.label.css("height", labelAlign === "north" ? self.element.height() + 'px' : "auto");
        }
        }
        else {
        if (labelAlign === "west" || labelAlign === "east" || labelAlign === "center") {
        self.label.css({ "line-height": self.element.height() + 'px', "width": self.element.width() + 'px' });
        }
        else
        if (labelAlign === "running") {
        self.label.css({ "height": "auto", "width": self.element.width() + 'px' });
        }
        else {
        self.element.css("line-height", "normal");
        self.valueDiv.css("line-height", "normal");
        self.label.css("height", labelAlign === "north" ? self.element.height() + 'px' : "auto");
        }
        }
        },
               ///get the progress bar's progress orientation.
        _isHorizontal: function () {
        return this.options.fillDirection === "west" || this.options.fillDirection === "east";
        },
            ///start the progress
        startTask: function () {
        ///

        Start the progress
        if ($(":animated", this.element).length == 0) {
        var value = this.value();
        this._refreshValue(value);
        }
        },
               ///stop the progress
        stopTask: function () {
        /// Stop the progress
        this.valueDiv.stop();
        },
               //init the progress bar
        _initElements: function () {
        var self = this;
        var o = self.options;
        self.element.removeClass("ui-wijprogressbar-west ui-wijprogressbar-east ui-wijprogressbar-north ui-wijprogressbar-south").addClass("ui-wijprogressbar-" + o.fillDirection);
        var height = self.element.height();
        self.valueDiv.css("line-height", "");
        self.label.removeClass("lb_west lb_east lb_south lb_north lb_center lb_running").addClass("lb_" + o.labelAlign)
        .css("line-height", "").css({
        left: "",
        right: "",
        top: "",
        bottom: ""
        });
        if (self._isHorizontal()) {
        self.valueDiv.height(height)
        .css("line-height", height + "px");
        }
        else {
        self.valueDiv.width(self.element.width());
        }
        self._setLabelSide();
        if (self.options.indicatorImage !== "") {
        self.valueDiv.css("background", "transparent url(" + self.options.indicatorImage + ") repeat fixed");
        }
        },
             ///refresh the progress
        _refreshProgress: function (value) {
        var self = this;
        var ea = new $.Event('progressChanging');
        var nowValue = value * (self.max - self.min) / 100 + self.min;
        var o = self.options;
        var cancel = self._triggerEvent("progressChanging", self.element.attr("aria-valuenow"), nowValue, false);
        if (cancel) {
        return;
        }
        if (self._isHorizontal()) {
        self.valueDiv.toggleClass(o.fillDirection === "east" ? "ui-corner-right" : "ui-corner-left", value === self.max).width(value + "%");
        }
        else {
        self.valueDiv.toggleClass(o.fillDirection === "south" ? "ui-corner-bottom" : "ui-corner-top", value === self.max).height(value + "%");
        }
        self.element.attr("aria-valuenow", nowValue);
        var txt = self._getFormatString(o.labelFormatString, value);
        self._setLabelsText(txt);
        var _tooTip = self._getFormatString(o.toolTipFormatString, value);
        self.element.attr("title", _tooTip);
        },
             ///play progress animation.
        _performAnimating: function (obj) {
        var self = this;
        var len = Math.floor(obj / self.options.indicatorIncrement);
        obj = len * self.options.indicatorIncrement;
        var o = self.options;
        self._refreshProgress(obj);

        if (o.labelAlign === "running") {
        if (self._isHorizontal()) {
        var eleWidth = self.element.width();
        var labelWidth = self.label.outerWidth();
        var progressWidth = self.valueDiv.outerWidth();
        var left = eleWidth === progressWidth ? eleWidth - labelWidth : obj * eleWidth / 100 - labelWidth + labelWidth * (eleWidth - progressWidth) / eleWidth;
        self.label.css(o.fillDirection === "east" ? "left" : "right", left);
        }
        else {
        var eleHeight = self.element.height();
        var labelHeight = self.label.outerHeight();
        var progressHeight = self.valueDiv.outerHeight();
        var top = eleHeight === progressHeight ? eleHeight - labelHeight : obj * eleHeight / 100 - labelHeight + labelHeight * (eleHeight - progressHeight) / eleHeight;
        self.label.css(o.fillDirection === "south" ? "top" : "bottom", top);
        }
        }
        },
               //set the label'text
        _setLabelsText: function (text) {
        if (!this._isHorizontal() && this.options.labelAlign === "rightOrBottom") {
        this.label.html('' + text + '');
        return;
        }

        this.label.html(text);
        },
               //format the text
        _getFormatString: function (format, val) {
        var self = this;
        var processValue = parseInt(self.element.attr("aria-valuenow"));
        var remainingProcess = self.max - processValue
        var percentProgress = val;
        var percentageRemaining = 100 - val;
        var r = /\{0\}/g;
        format = format.replace(r, processValue.toString());
        r = /\{ProgressValue\}/g;
        format = format.replace(r, processValue.toString());
        r = /\{1\}/g;
        format = format.replace(r, percentProgress.toString());
        r = /\{PercentProgress\}/g;
        format = format.replace(r, percentProgress.toString());
        r = /\{2\}/g;
        format = format.replace(r, remainingProcess.toString());
        r = /\{RemainingProgress\}/g;
        format = format.replace(r, remainingProcess.toString());
        r = /\{3\}/g;
        format = format.replace(r, percentageRemaining.toString());
        r = /\{PercentageRemaining\}/g;
        format = format.replace(r, percentageRemaining.toString());
        r = /\{4\}/g;
        format = format.replace(r, self.min);
        r = /\{Min\}/g;
        format = format.replace(r, self.min);
        r = /\{5\}/g;
        format = format.replace(r, self.max);
        r = /\{Max\}/g;
        format = format.replace(r, self.max);
        return format;
        },
               ///destroy the widget.
        destroy: function () {
        this.element.empty();
        this.element.removeClass("ui-wijprogressbar ui-widget ui-widget-content ui-corner-all ui-wijprogressbar-h").removeAttr("title");
        $.Widget.prototype.destroy.apply(this, arguments);
        }
        });
          ///progress bar animation. If user want to write custom animation,can override the animations option.And set the animated to the options key.
        $.extend($.ui.wijprogressbar, {
        animations: {
        progress: function (options, additions) {
        options = $.extend({
        easing: "swing",
        duration: 1000
        }, options, additions);
        options.content.stop(true, true).animate({
        widthvalue: options.processValue
        }, options);
        }
        }
        });
        })(jQuery);

        widget主要是處理ui層面的,實用與否只有用了才知道,widget可以利用jQuery已經(jīng)存在的css framework。利用themeRoller,可以很輕松的換膚。至于說功能,可以在用戶反饋后再慢慢完善。
        這個progressbar本身是繼承自jQuery ui progressbar的。因為開源,如果自己有好的想法,自己也可以去增加自己需要的功能。

        聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        基于jquery的一個progressbarwidge_jquery

        基于jquery的一個progressbarwidge_jquery:此項目的demo網(wǎng)站http://wijmo.com/Wijmo-Open/samples/ 代碼如下: /* * wijprogressbar Widget. V1.0 * * Copyright (c) Componentone Inc. * * Depends: * Jquery-1.4.2.js * jquery.ui.core.js *
        推薦度:
        標簽: 進度條 one jQuery
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 亚洲天堂2017无码中文| 亚洲大尺度无码无码专区| 亚洲情A成黄在线观看动漫软件| 日韩精品极品视频在线观看免费| 亚洲s色大片在线观看| 三级黄色片免费看| 亚洲色无码专区一区| 青青草免费在线视频| 日韩亚洲国产高清免费视频| 午夜网站免费版在线观看| 亚洲色成人中文字幕网站 | 在线观看免费污视频| 亚洲一卡2卡三卡4卡无卡下载 | 免费下载成人电影| 亚洲愉拍一区二区三区| 日日AV拍夜夜添久久免费| 在线观看亚洲免费| 亚洲自偷自偷图片| 日韩午夜理论免费TV影院| 四虎亚洲精品高清在线观看| 国产在线ts人妖免费视频| 一个人免费观看视频在线中文| 亚洲香蕉成人AV网站在线观看| 精品无码AV无码免费专区| 在线亚洲午夜片AV大片| 免费一级一片一毛片| 精品97国产免费人成视频| 99亚洲精品高清一二区| 亚洲免费日韩无码系列| 亚洲av之男人的天堂网站| 久久这里只有精品国产免费10| 美女裸免费观看网站| 国产一级理论免费版| 国产成人精品免费视频大全| 亚洲精品在线视频观看| 热久久精品免费视频| 亚洲熟女乱色一区二区三区| 亚洲日本一区二区三区在线不卡| 99re免费视频| 男女啪啪免费体验区| 亚洲国产精品成人综合色在线婷婷 |