zoukankan      html  css  js  c++  java
  • jquery为开发插件提供了两个方法

    // 补充知识点:jquery为开发插件提供了两个方法,方别为
    //1、jQuery.fn.extend(object) ->给jquery对象添加方法 $('.ele').add()
    //2、jQuery.extend(object)->给jquery类添加方法; $.add()

    //2.1:
    //$.extend()的嵌套多个对象功能,例如:
    //var Css1={size: "10px",style: "oblique"}
    // var Css2={size: "12px",style: "oblique",weight: "bolder"}
    // $.jQuery.extend(Css1,Css2);
    //结果:Css1的size属性被覆盖,而且继承了Css2的weight属性
    // Css1 = {size: "12px",style: "oblique",weight: "bolder"}

    //2.2:
    //$.extend()深度嵌套对象
    //{ name: “John”, location: { city: “Boston” } };
    //{ last: “Resig”, location: { state: “MA” } };
    // 结果:
    // => { name: “John”, last: “Resig”, location: { state: “MA” } }
    // 新的更深入的 .extend()
    // jQuery.extend( true,
    // { name: “John”, location: { city: “Boston” } },
    // { last: “Resig”, location: { state: “MA” } }
    // );
    // 结果
    // => { name: “John”, last: “Resig”,
    // location: { city: “Boston”, state: “MA” } }

  • 相关阅读:
    分分钟搞定Python之排序与列表
    分分钟搞定Python之排序与列表
    联系我
    联系我
    联系我
    联系表单 1_copy
    联系表单 1_copy
    联系表单 1_copy
    联系表单 1
    联系表单 1
  • 原文地址:https://www.cnblogs.com/sunqq/p/9910286.html
Copyright © 2011-2022 走看看