WinJS.UI.Animation.hide function

[This documentation is preliminary and is subject to change.]

Applies to: Metro style apps only

Performs an animation that hides user interface (UI) in response to a touch or click.

Syntax

WinJS.UI.Animation.hide(background, content, offset, outline, tapped).done( /* Your success and error handlers */ );

Parameters

  • background
    Type: Object

    Element or elements that constitute the background.

  • content
    Type: Object

    Element or elements that represent the content being hidden.

  • offset
    Type: Object

    Initial offsets where the objects to be hidden begin relative to their final position at the end of the animation. Set this parameter to null to use the recommended default offset.

    Note  When the incoming parameter specifies an array of elements, the offset parameter can specify an offset array with each item specified for its corresponding element array item. If the array of offsets is smaller than the array of elements, the last offset is applied to all remaining elements.

  • outline
    Type: Object

    Element or elements that form a frame around the content being hidden.

  • tapped
    Type: Object

    Element or elements that represent the tapped portion of the object.

Return value

Type: Promise

An object that completes when the animation is finished.

Remarks

The background, content, outline, and tapped parameters can be expressed in several ways:

  • As the special value "undefined", which means that the animation has no such target
  • As a single object
  • As a JavaScript array (possibly empty), in which each element of the array can be a single element or a JavaScript array of elements.
  • As a NodeList (for example, the result of querySelectorAll)
  • As an HTMLCollection

The offset parameter can also be provided in several forms:

  • As the special value "undefined", which can be specified explicitly in the call or specified implicitly by omitting the parameter value. The undefined value means that the animation's default offset will be used.

  • As a single JavaScript object of this form:

    { top: string, left: string, rtlflip: true | false }

    For example:

    { top: "12px", left: "0px", rtlflip: true }

    The object must have properties named top and left that represent the offset applied at the beginning of the animation. Any valid CSS units can be used to express the offset. In this form, the offset applies to all elements involved in the animation.

    The rtlflip parameter flips the values to a right-to-left alignment. It affects the left parameter and changes its sign. For instance, 10 px becomes -10px. This parameter is optional and can be omitted. If it is omitted, the default value is false.

  • As a JavaScript array (possibly empty) of the {top: ..., left: ..., rtlflip: ...} objects discussed above. In this case, each object in the array applies to a single element in the animation, in the order given; the first object applies to the first element, the second to the second, and so on. If the number of elements is greater than the number of objects in this array, then the last element in the array applies to all of the remaining elements.

If you want to remove an element involved in this animation from the document altogether, doing so before the animation is complete causes the animation to abruptly stop. You should use the Promise to be notified when the animation completes and then remove the element from the document.

Requirements

Minimum supported client

Windows 8 Release Preview

Minimum supported server

Windows Server 2012

Namespace

WinJS.UI.Animation

Library

Ui.js

See also

reveal

 

 

Build date: 5/22/2012