• jQuery核心探究


    动画animate
    .animate({}, {
      duration: 5000,
      progress: function (now, progressNum) {},
      complete: function () {}
    });

    停止动画
    .stop() 停止当前动画,其他的继续
    .stop(true) 动画都停止
    .stop(true, true) 动画停止,并且元素回到最后的状态

    核心方法
    $.each(argument0, argument1);
    argument0 是对象或者数组
    argument1 是一个回调函数

    $.each(['lqc', '技术研究'], function (index, value) {
      // index是索引,也就是数组的索引
      // value就是数组中的值了

      return false; // 停止以后所有循环
    });


    $.inArray() 判断某个元素是否存在数组中
    ECMAScript5 支持indexOf方法的判断,但是$.inArray()保持了向下兼容

    $.inArray(value, array, [指定索引开始的位置]);

    $.inArray(5, [1, 2, 3, 4, 5, 6, 7]) // 返回对应的索引:4
    $.inArray('a', ['a','b','c','d','a','e'], 2)
    // 返回对应的索引值 4

    运用小技巧:
    如果要判断数组中是否存在指定值,你需要通过该函数的返回值不等于(或大于)-1来进行判断


    一组相同元素取其一转换为JavaScript对象:
    .get(0)
    .get(-1)

  • 相关阅读:
    Reverse Nodes in k-Group [LeetCode]
    Text Justification [LeetCode]
    Path Sum [LeetCode]
    Multiply Strings [LeetCode]
    Populating Next Right Pointers in Each Node II [Leetcode]
    013 集合
    012 元组
    02 isdecimal(), isdigit(), isnumeric()
    011 字符串的内置方法 三
    010 字符串的内置方法 二
  • 原文地址:https://www.cnblogs.com/lqcdsns/p/5599078.html
Copyright © 2020-2023  润新知