做视频网站付费版,品牌公关,怎样从网上卖东西啊,杭州在线制作网站//1、初次实例化时将插件对象缓存在dom上#xff0c;后续则可直接调用#xff0c;避免在相同元素下widget的多实例化。简单的说#xff0c;就是一个单例方法。 //2、合并用户提供的默认设置选项options //3、可以通过调用插件时传递字符串来调用插件内的方法。如:$(‘#id’… //1、初次实例化时将插件对象缓存在dom上后续则可直接调用避免在相同元素下widget的多实例化。简单的说就是一个单例方法。 //2、合并用户提供的默认设置选项options //3、可以通过调用插件时传递字符串来调用插件内的方法。如:$(‘#id’).menu(‘hide’) 实际就是实例插件并调用hide()方法。 //4、同时限制外部调用“_”下划线的私有方法 $.fn[name] function(options) { var isMethodCall typeof options “string”, args widget_slice.call(arguments, 1), returnValue this; // allow multiple hashes to be passed on init. //可以简单认为是$.extend(true,options,args[0],…),args可以是一个参数或是数组 options !isMethodCall args.length ? $.widget.extend.apply(null, [options].concat(args)) : options; //这里对字符串和对象分别作处理 if (isMethodCall) { this.each(function() { var methodValue, instance $.data(this, fullName); //如果传递的是instance则将this返回。 if (options “instance”) { returnValue instance; return false; } if (!instance) { return $.error(cannot call methods on name prior to initialization; “attempted to call method ” options “”); } //这里对私有方法的调用做了限制直接调用会抛出异常事件 if (!$.isFunction(instance[options]) || options.charAt(0) “_”) { return $.error(“no such method ” options “’ for name widget instance”); } //这里是如果传递的是字符串则调用字符串方法并传递对应的参数. //比如插件有个方法hide(a,b); 有2个参数ab //则调用时$(‘#id’).menu(‘hide’,1,2);//1和2 分别就是参数a和b了。 methodValue instance[options].apply(instance, args); if (methodValue ! instance methodValue ! undefined) { returnValue methodValue methodValue.jquery ? returnValue.pushStack(methodValue.get()) : methodValue; return false; } }); } else { this.each(function() { var instance $.data(this, fullName); if (instance) { instance.option(options || {}); //这里每次都调用init方法 if (instance._init) { instance._init(); } } else { //缓存插件实例 $.data(this, fullName, new object(options, this)); } }); } return returnValue; }; }; //这里是真正的widget基类 $.Widget function( /* options, element */ ) {}; $.Widget._childConstructors []; $.Widget.prototype { widgetName: “widget”, //用来决定事件的名称和插件提供的callbacks的关联。 // 比如dialog有一个close的callback当close的callback被执行的时候一个dialogclose的事件被触发。 // 事件的名称和事件的prefixcallback的名称。widgetEventPrefix 默认就是控件的名称但是如果事件需要不同的名称也可以被重写。 // 比如一个用户开始拖拽一个元素,我们不想使用draggablestart作为事件的名称我们想使用dragstart所以我们可以重写事件的prefix。 // 如果callback的名称和事件的prefix相同事件的名称将不会是prefix。 // 它阻止像dragdrag一样的事件名称。 widgetEventPrefix: “”, defaultElement: “ ”, //属性会在创建模块时被覆盖 options: { disabled: false, // callbacks create: null }, _createWidget: function(options, element) { element $(element || this.defaultElement || this)[0]; this.element $(element); this.uuid widget_uuid; this.eventNamespace “.” this.widgetName this.uuid; this.options $.widget.extend({}, this.options, this._getCreateOptions(), options); this.bindings $(); this.hoverable $(); this.focusable $(); if (element ! this) { // debugger $.data(element, this.widgetFullName, this); this._on(true, this.element, { remove: function(event) { if (event.target element) { this.destroy(); } } }); this.document $(element.style ? // element within the document element.ownerDocument : // element is window or document element.document || element); this.window $(this.document[0].defaultView || this.document[0].parentWindow); } this._create(); //创建插件时有个create的回调 this._trigger(“create”, null, this._getCreateEventData()); this._init(); }, _getCreateOptions: $.noop, _getCreateEventData: $.noop, _create: $.noop, _init: $.noop, //销毁模块去除绑定事件、去除数据、去除样式、属性 destroy: function() { this._destroy(); // we can probably remove the unbind calls in 2.0 // all event bindings should go through this._on() this.element.unbind(this.eventNamespace).removeData(this.widgetFullName) // support: jquery 1.6.3 // http://bugs.jquery.com/ticket/9413 .removeData($.camelCase(this.widgetFullName)); this.widget().unbind(this.eventNamespace).removeAttr(“aria-disabled”).removeClass( this.widgetFullName -disabled “ui-state-disabled”); // clean up events and states this.bindings.unbind(this.eventNamespace); this.hoverable.removeClass(“ui-state-hover”); this.focusable.removeClass(“ui-state-focus”); }, _destroy: $.noop, widget: function() { return this.element; }, //设置选项函数 option: function(key, value) { var options key, parts, curOption, i; if (arguments.length 0) { // don’t return a reference to the internal hash //返回一个新的对象不是内部数据的引用 return $.widget.extend({}, this.options); } if (typeof key “string”) { // handle nested keys, e.g., “foo.bar” { foo: { bar: ___ } } options {}; parts key.split(“.”); key parts.shift(); if (parts.length) { curOption options[key] $.widget.extend({}, this.options[key]); for (i 0; i parts.length - 1; i) { curOption[parts[i]] curOption[parts[i]] || {}; curOption curOption[parts[i]]; } key parts.pop(); if (arguments.length 1) { return curOption[key] undefined ? null : curOption[key]; } curOption[key] value; } else { if (arguments.length 1) { return this.options[key] undefined ? null : this.options[key]; } options[key] value; } } this._setOptions(options); return this; }, _setOptions: function(options) { var key; for (key in options) { this._setOption(key, options[key]); } return this; }, _setOption: function(key, value) { this.options[key] value; if (key “disabled”) { this.widget().toggleClass(this.widgetFullName “-disabled”, !! value); // If the widget is becoming disabled, then nothing is interactive if (value) { this.hoverable.removeClass(“ui-state-hover”); this.focusable.removeClass(“ui-state-focus”); } } return this; }, enable: function() { return this._setOptions({ disabled: false }); }, disable: function() { return this._setOptions({ disabled: true }); }, _on: function(suppressDisabledCheck, element, handlers) { var delegateElement, instance this; // no suppressDisabledCheck flag, shuffle arguments if (typeof suppressDisabledCheck ! “boolean”) { handlers element; element suppressDisabledCheck; suppressDisabledCheck false; } // no element argument, shuffle and use this.element if (!handlers) { handlers element; element this.element; delegateElement this.widget(); } else { // accept selectors, DOM elements element delegateElement $(element); this.bindings this.bindings.add(element); } $.each(handlers, function(event, handler) { function handlerProxy() { // allow widgets to customize the disabled handling // - disabled as an array instead of boolean // - disabled class as method for disabling individual parts if (!suppressDisabledCheck (instance.options.disabled true || $(this).hasClass(“ui-state-disabled”))) { return; } return (typeof handler “string” ? instance[handler] : handler).apply(instance, arguments); } // copy the guid so direct unbinding works if (typeof handler ! “string”) { handlerProxy.guid handler.guid handler.guid || handlerProxy.guid || $.guid; } var match event.match(/^([\w:-]*)\s*(.*)$/), eventName match[1] instance.eventNamespace, selector match[2]; if (selector) { delegateElement.delegate(selector, eventName, handlerProxy); } else { element.bind(eventName, handlerProxy); } }); }, _off: function(element, eventName) { eventName (eventName || “”).split( ).join(this.eventNamespace ) this.eventNamespace; element.unbind(eventName).undelegate(eventName); }, _delay: function(handler, delay) { function handlerProxy() { return (typeof handler “string” ? instance[handler] : handler).apply(instance, arguments); } var instance this; return setTimeout(handlerProxy, delay || 0); }, _hoverable: function(element) { this.hoverable this.hoverable.add(element); this._on(element, { mouseenter: function(event) { $(event.currentTarget).addClass(“ui-state-hover”); }, mouseleave: function(event) { $(event.currentTarget).removeClass(“ui-state-hover”); } }); }, _focusable: function(element) { this.focusable this.focusable.add(element); this._on(element, { focusin: function(event) { $(event.currentTarget).addClass(“ui-state-focus”); }, focusout: function(event) { $(event.currentTarget).removeClass(“ui-state-focus”); } }); }, _trigger: function(type, event, data) { var prop, orig, callback this.options[type]; data data || {}; event $.Event(event); event.type (type this.widgetEventPrefix ? type : this.widgetEventPrefix type).toLowerCase(); // the original event may come from any element // so we need to reset the target on the new event event.target this.element[0]; // copy original event properties over to the new event orig event.originalEvent; if (orig) { for (prop in orig) {
自我介绍一下小编13年上海交大毕业曾经在小公司待过也去过华为、OPPO等大厂18年进入阿里一直到现在。
深知大多数前端工程师想要提升技能往往是自己摸索成长或者是报班学习但对于培训机构动则几千的学费着实压力不小。自己不成体系的自学效果低效又漫长而且极易碰到天花板技术停滞不前
因此收集整理了一份《2024年Web前端开发全套学习资料》初衷也很简单就是希望能够帮助到想自学提升又不知道该从何学起的朋友同时减轻大家的负担。
既有适合小白学习的零基础资料也有适合3年以上经验的小伙伴深入学习提升的进阶课程基本涵盖了95%以上前端开发知识点真正体系化
由于文件比较大这里只是将部分目录大纲截图出来每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频并且后续会持续更新
如果你觉得这些内容对你有帮助可以添加V获取vip1024c 备注前端
最后
推荐一些系统学习的途径和方法。 每个Web开发人员必备很权威很齐全的Web开发文档。作为学习辞典使用可以查询到每个概念、方法、属性的详细解释注意使用英文关键字搜索。里面的一些 HTMLCSSHTTP 技术教程也相当不错。
CodeChina开源项目【大厂前端面试题解析核心总结学习笔记真实项目实战最新讲解视频】
HTML 和 CSS 识点真正体系化**
由于文件比较大这里只是将部分目录大纲截图出来每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频并且后续会持续更新
如果你觉得这些内容对你有帮助可以添加V获取vip1024c 备注前端 [外链图片转存中…(img-O2GEVXKW-1711756375226)]
最后
推荐一些系统学习的途径和方法。 每个Web开发人员必备很权威很齐全的Web开发文档。作为学习辞典使用可以查询到每个概念、方法、属性的详细解释注意使用英文关键字搜索。里面的一些 HTMLCSSHTTP 技术教程也相当不错。
CodeChina开源项目【大厂前端面试题解析核心总结学习笔记真实项目实战最新讲解视频】
HTML 和 CSS