• jQuery队列(一)


    jQuery的队列依赖缓存机制事件,它同时是animate的基础。

    它不像事件机制、缓存机制、回调机制一样有自己的命名空间,由于比较简单,所以直接挂在到$和jQuery对象上。

    它提供的基础方法有:

    jQuery.extend({
        queue: function( elem, type, data ) {

      var queue;
        // 如果存在elem,也就是至少有一个参数
            if ( elem ) {

         // 如果有第二个参数,使用第二个参数加上“queue”,否则使用“fx” + “queue”(动画队列的名称)
                type = ( type || "fx" ) + "queue";

         // 到jQuery内部使用的data_priv缓存对象中去取已type为key的值
                queue = data_priv.get( elem, type );

         // 如果存在第三个参数
                if ( data ) {

           // 如果elem还没有在cache中存储过名为type的数据,或者需要存储的数据时数组
                    if ( !queue || jQuery.isArray( data ) ) {

             //
                        queue = data_priv.access( elem, type, jQuery.makeArray(data) );

           // 否则,直接将data推入到队列中
                    } else {
                        queue.push( data );
                    }
                }

         // 返回队列
                return queue || [];
            }

      }, // 将数据按照某种类型存储到elem上
        dequeue: function( elem, type ) {}, // 从elem上删除某种类型的数据
        _queueHooks: function( elem, type ) {} // 内部使用
    });

    jQuery.fn.extend({
        queue: function( type, data ) {},
        dequeue: function( type ) {},
        delay: function( time, type ) {},
        clearQueue: function( type ) {},
        promise: function( type, obj ) {}
    });

  • 相关阅读:
    maven项目下出现java.lang.ClassNotFoundException: ContextLoader异常
    jquery使用post方法传值
    商品筛选条件
    商品的上架
    使用fckeditor上传多张图片
    多选删除
    升讯威 .Net WinForm 开源控件使用——c#
    设置label(标签)控件的背景颜色为透明
    鼠标拖动控件跟随——C#
    Chart控件系列教程——c#
  • 原文地址:https://www.cnblogs.com/charling/p/3486078.html
Copyright © 2020-2023  润新知