Function transitionElement

Like transitionElementNow except it will waitForMutateTime, and optionally a delay, and it finally awaits for the effective style's transition-duration.

If a delay is supplied, then the transition is "scheduled" and if the opposite transition is executed before the scheduled one, this one is cancelled.

hideElement(someElement, 10);
// this will be aborted in 10ms when the scheduled hideElement above
// completes
showElement(someElement, 100);
// this will be aborted in 10ms when the hideElement that will be scheduled
// below completes
showElement(someElement, 100);
hideElement(someElement, 10);
// this will be aborted immediately by hideElementNow that runs straight
// afterwards
showElement(someElement, 100);
hideElementNow(someElement);
hideElementNow(someElement);
// this will NOT be aborted because hideElementNow has completed already
showElement(someElement, 100);
  • Parameters

    • element: Element
    • fromCls: string
    • toCls: string
    • delay: number = 0

    Returns Promise<boolean>