Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jqueryui标签插件坏了_Jquery_Jquery Ui_Jquery Plugins_Jquery Ui Tabs - Fatal编程技术网

jqueryui标签插件坏了

jqueryui标签插件坏了,jquery,jquery-ui,jquery-plugins,jquery-ui-tabs,Jquery,Jquery Ui,Jquery Plugins,Jquery Ui Tabs,我们使用的是这个fiddle:中的jQueryUITabs箭头插件,但与许多插件一样,它与最新版本的jquery中断。我们能够让csscur正常工作,但jquery核心中仍然存在以下错误(第353行): 未捕获类型错误:无法分配给函数(e,t)的只读属性“length”{if(!this.\u createWidget)返回新的o(e,t);arguments.length&&this.\u createWidget(e,t)} 代码如下: (function($, undefined) {

我们使用的是这个fiddle:中的jQueryUITabs箭头插件,但与许多插件一样,它与最新版本的jquery中断。我们能够让csscur正常工作,但jquery核心中仍然存在以下错误(第353行):

未捕获类型错误:无法分配给函数(e,t)的只读属性“length”{if(!this.\u createWidget)返回新的o(e,t);arguments.length&&this.\u createWidget(e,t)}

代码如下:

(function($, undefined) {
    if (!$.xui) {
        $.xui = {};
    }
    var tabs = $.extend({}, $.ui.tabs.prototype),
        _super = {
            _create: tabs._create,
            _destroy: tabs._destroy,
            _update: tabs._update
        };
    $.xui.tabs = $.extend(tabs, {
        options: $.extend({}, tabs.options, {
            scrollable: false,
            changeOnScroll: false,
            closable: false,
            resizable: false,
            resizeHandles: "e,s,se"
        }),
        _create: function() {
            var self = this,
                o = self.options;
            _super._create.apply(self);
            if (o.scrollable) {
                self.element.addClass("ui-tabs-scrollable");
                var scrollContainer = $('<div class="ui-tabs-scroll-container"></div>').prependTo(this.element);
                self.header = $('<div class="ui-tabs-nav-scrollable ui-widget-header ui-corner-all"></div>').prependTo(scrollContainer);
                var nav = self.element.find(".ui-tabs-nav:first").removeClass("ui-widget-header ui-corner-all").appendTo(this.header);
                var arrowsNav = $('<ol class="ui-helper-reset ui-helper-clearfix ui-tabs-nav-arrows"></ol>').prependTo(self.element);
                var navPrev = $('<li class="ui-tabs-arrow-previous ui-state-default ui-corner-bl ui-corner-tl" title="Previous"><a href="#"><span class="ui-icon ui-icon-carat-1-w">Previous tab</span></a></li>').prependTo(arrowsNav).hide(),
                    navNext = $('<li class="ui-tabs-arrow-next ui-state-default ui-corner-tr ui-corner-br" title="Next"><a href="#"><span class="ui-icon ui-icon-carat-1-e">Next tab</span></a></li>').appendTo(arrowsNav).hide();


                var scrollTo = function(to, delay) {
                    var navWidth = 0,
                        arrowWidth = navPrev.outerWidth(),
                        marginLeft = -(parseInt(nav.css("marginLeft"), 10)),
                        hwidth = self.header.width(),
                        newMargin = 0;

                    nav.find("li").each(function() {
                        navWidth += $(this).outerWidth(true);
                    });

                    if (to instanceof $.Event) {

                    } else {
                        newMargin = marginLeft+to;
                        if (newMargin > (navWidth-hwidth)) {
                            newMargin = (navWidth-hwidth);
                        } else if (newMargin < 0) {
                            newMargin = 0;
                        }
                        nav.stop(true).animate({
                            marginLeft: -(newMargin)
                        }, delay, function(){
                            $(window).trigger("resize.tabs");
                        });
                    }
                }


                var holdTimer = false;
                navPrev.add(navNext).bind({
                    "click": function(e) {
                        var isNext = this === navNext[0];
                        e.preventDefault();
                        if (o.changeOnScroll) {
                            self.select(self.options.selected + (isNext ? 1 : -1));
                        } else {
                            if (!holdTimer)
                                scrollTo(isNext ? 150 : -150, 250);
                        }
                    },
                    "mousedown": function(e){
                        if (!o.changeOnScroll) {
                            var isNext = this === navNext[0],
                                duration = 10, pos = 15, timer;
                            if (holdTimer)
                                clearTimeout(holdTimer);
                            holdTimer = setTimeout(timer = function(){
                                scrollTo(isNext ? pos : -(pos), duration);
                                holdTimer = setTimeout(arguments.callee, duration);
                            }, 150);
                        }
                    },
                    "mouseup mouseout": function(e){
                        if (!o.changeOnScroll) {
                            clearTimeout(holdTimer);
                            holdTimer = false;
                            nav.stop();
                        }
                    }
                });

                self.header.bind('mousewheel', function(e, d, dX, dY) {
                    e.preventDefault();
                    if (d === -1) {
                        navNext.click();
                    } else if (d === 1) {
                        navPrev.click();
                    }
                });

                $(window).bind("resize.tabs", function(e) {
                    var navWidth = 0;
                    var arrowWidth = navPrev.outerWidth();
                    nav.find("li").each(function() {
                        navWidth += $(this).outerWidth(true);
                    });

                    var marginLeft = -(parseInt(nav.css("marginLeft"), 10)),
                        hwidth = self.header.width();

                    if (navWidth > (hwidth+marginLeft)) {
                        self.header.addClass("ui-tabs-arrow-r");
                        navNext.show("fade");
                        if (marginLeft > 0) {
                            self.header.addClass("ui-tabs-arrow-l");
                            navPrev.show("fade");
                        } else {
                            self.header.removeClass("ui-tabs-arrow-l");
                            navPrev.hide("fade");
                        }
                    } else {
                        self.header.removeClass("ui-tabs-arrows ui-tabs-arrow-l");
                        navNext.hide("fade");
                        if (marginLeft > 0) {
                            self.header.addClass("ui-tabs-arrow-l");
                            navPrev.show("fade");
                        } else {
                            self.header.removeClass("ui-tabs-arrow-l");
                            navPrev.hide("fade");
                        }
                    }
                }).trigger("resize.tabs");

                arrowsNav.find("li").bind({
                    "mouseenter focus": function(e) {
                        $(this).addClass("ui-state-hover");
                    },
                    "mouseleave blur": function(e) {
                        $(this).removeClass("ui-state-hover");
                    }
                });

                this.anchors.bind("click.tabs", function(){
                    var li = $(this).parent(),
                        arrowWidth = navPrev.outerWidth(),
                        width = li.outerWidth(true),
                        hwidth = self.header.width(),
                        pos = li.position().left,
                        marginLeft = -(parseInt(nav.stop(true,true).css("marginLeft"),10)),
                        newMargin = -1;

                    if (li.index() === 0) {
                        newMargin = 0;
                    } else if ((pos+width) >= (hwidth+marginLeft)) {
                        newMargin = pos-hwidth+width;
                        if ((li.index()+1) < nav.find("li").length) {
                            newMargin += arrowWidth;
                        }
                    } else if (pos < marginLeft) {
                        newMargin = pos-arrowWidth;
                    }

                    if (newMargin > -1) {
                        nav.animate({
                            marginLeft: -(newMargin)
                        }, 250, function(){
                            $(window).trigger("resize.tabs");
                        });
                    }
                });
            }
            return self;
        },
        _update: function(){
            console.log(arguments);
            _super._update.apply(this);
        }
    });
    $.widget("xui.tabs", $.xui.tabs);
})(jQuery);
$(function() {
    $("#tabs").tabs({
        scrollable: true,
        changeOnScroll: false,
        closable: true
    });
    $("#switcher").themeswitcher();
});
(函数($,未定义){
如果(!$.xui){
$.xui={};
}
var tabs=$.extend({},$.ui.tabs.prototype),
_超级={
_创建:选项卡。\u创建,
_销毁:选项卡。\u销毁,
_更新:选项卡。\u更新
};
$.xui.tabs=$.extend(选项卡{
选项:$.extend({},tabs.options{
可滚动:false,
更改:错误,
可关闭:错误,
可调整大小:false,
resizeHandles:“e、s、se”
}),
_创建:函数(){
var self=这个,
o=自我选择;
_超级。创建。应用(自我);
如果(可滚动){
self.element.addClass(“可滚动的ui选项卡”);
var scrollContainer=$('').prependTo(this.element);
self.header=$('').prependTo(滚动容器);
var nav=self.element.find(“.ui tabs nav:first”).removeClass(“ui小部件头ui角点全部”).appendTo(this.header);
var arrowsNav=$('').prependTo(self.element);
var navPrev=$('
  • ).prependTo(arrowsNav).hide(), navNext=$('
  • ).appendTo(arrowsNav).hide(); var scrollTo=功能(to,延迟){ var navWidth=0, arrowWidth=navPrev.outerWidth(), marginLeft=-(parseInt(nav.css(“marginLeft”),10)), hwidth=self.header.width(), newMargin=0; 导航查找(“li”)。每个(函数(){ navWidth+=$(此).outerWidth(真); }); if(到instanceof$.Event){ }否则{ newMargin=marginLeft+to; 如果(新边距>(导航宽度宽度){ 新边距=(导航宽度宽度宽度); }else if(newMargin<0){ newMargin=0; } 导航停止(真)。设置动画({ marginLeft:-(新页边距) },延迟,函数(){ $(window.trigger(“resize.tabs”); }); } } var-holdTimer=false; navPrev.add(navNext.bind)({ “点击”:功能(e){ var isNext=this==navNext[0]; e、 预防默认值(); 如果(o.ChangesCroll){ self.select(self.options.selected+(isNext?1:-1)); }否则{ 如果(!holdTimer) 滚动到(isNext?150:-150250); } }, “鼠标向下”:功能(e){ 如果(!o.ChangesCroll){ var isNext=this==navNext[0], 持续时间=10,位置=15,定时器; if(保持计时器) clearTimeout(保持计时器); holdTimer=setTimeout(timer=function(){ 滚动至(isNext?位置:-(位置),持续时间); holdTimer=setTimeout(arguments.callee,duration); }, 150); } }, “mouseup mouseout”:函数(e){ 如果(!o.ChangesCroll){ clearTimeout(保持计时器); holdTimer=false; 导航停止(); } } }); self.header.bind('mousewheel',函数(e,d,dX,dY){ e、 预防默认值(); 如果(d==-1){ navNext.click(); }else如果(d==1){ navPrev.click(); } }); $(窗口).bind(“resize.tabs”,函数(e){ var-navWidth=0; var arrowWidth=navPrev.outerWidth(); 导航查找(“li”)。每个(函数(){ navWidth+=$(此).outerWidth(真); }); var marginLeft=-(parseInt(nav.css(“marginLeft”),10)), hwidth=self.header.width(); 如果(导航宽度>(宽度+边缘左侧)){ self.header.addClass(“ui-tabs-arrow-r”); 显示(“淡出”); 如果(marginLeft>0){ self.header.addClass(“ui-tabs-arrow-l”); 导航显示(“褪色”); }否则{ self.header.removeClass(“ui-tabs-arrow-l”); navPrev.隐藏(“褪色”); } }否则{ self.header.removeClass(“ui选项卡箭头ui-tabs-arrow-l”); 隐藏(“褪色”); 如果(marginLeft>0){ self.header.addClass(“ui选项卡箭头
        if ( existingConstructor ) {
                $.each( existingConstructor._childConstructors, function( i, child ) {
                        var childPrototype = child.prototype;
    
                        // redefine the child widget using the same prototype that was
                        // originally used, but inherit from the new version of the base
                        $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
                });
                // remove the list of existing child constructors from the old constructor
                // so the old child constructors can be garbage collected
                delete existingConstructor._childConstructors;
        } else {
                base._childConstructors.push( constructor );
        }
    
        if ( existingConstructor ) {
            if (!(typeof existingConstructor._childConstructors === 'undefined')) {
                $.each( existingConstructor._childConstructors, function( i, child ) {
                        var childPrototype = child.prototype;
    
                        // redefine the child widget using the same prototype that was
                        // originally used, but inherit from the new version of the base
                        $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
                });
                // remove the list of existing child constructors from the old constructor
                // so the old child constructors can be garbage collected
                delete existingConstructor._childConstructors;
            }
        } else {
                base._childConstructors.push( constructor );
        }