Class: Fx.Elements

Fx.Elements allows you to apply any number of styles transitions to a collection of Elements.

Extends:

Fx

Синтаксис:

new Fx.Elements(elements[, options]);

Аргументы:

  1. elements - (array) A collection of Elements the effects will be applied to.
  2. options - (object, optional) Same as Fx options.

Возвращает:

  • (object) A new Fx.Elements instance.

Примеры:

var myFx = new Fx.Elements($$('.myElementClass'), {

    onComplete: function(){
        alert('complete');
    }
}).start({

    '0': {
        'height': [200, 300],
        'opacity': [0,1]

    },
    '1': {
        'width': [200, 300],
        'opacity': [1,0]

    }
});

Notes:

  • Includes colors but must be in hex format.

Fx.Elements Method: set

Applies the passed in style transitions to each object named immediately (see example).

Синтаксис:

myFx.set(to);

Аргументы:

  1. to - (object) An object where each item in the collection is refered to as a numerical string ("1" for instance). The first item is "0", the second "1", etc.

Возвращает:

  • (object) This Fx.Elements instance.

Примеры:

var myFx = new Fx.Elements($$('.myClass')).set({

    '0': {
        'height': 200,
        'opacity': 0
    },
    '1': {

        'width': 300,
        'opacity': 1
    }
});

Fx.Elements Method: start

Applies the passed in style transitions to each object named (see example).

Синтаксис:

myFx.start(obj);

Аргументы:

  1. obj - (object) An object where each item in the collection is refered to as a numerical string ("1" for instance). The first item is "0", the second "1", etc.

Возвращает:

  • (object) This Fx.Elements instance.

Примеры:

var myElementsEffects = new Fx.Elements($$('a'));
myElementsEffects.start({

    '0': { //let's change the first element's opacity and width
        'opacity': [0,1],
        'width': [100,200]

    },
    '4': { //and the fifth one's opacity
        'opacity': [0.2, 0.5]

    }
});

Эта документация распостраняется на правах Attribution-NonCommercial-ShareAlike 3.0 License.
Оригинал документации на английском.
© Linux.ria.ua, 2008-2024