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” } }

  • 相关阅读:
    4.22日日常记录
    ajax再接触
    一些小姿势
    打星功能
    悟透javascript读书笔记
    初接触eclipse和前后端调试问题 待续
    python实现后台员工管理系统
    python实现增删改查操作
    python实现6种方法打印九九乘法表
    python实现猜数字游戏
  • 原文地址:https://www.cnblogs.com/sunqq/p/9910286.html
Copyright © 2011-2022 走看看