共用方式為


Flyout.showAt method

Shows the Flyout, if hidden, regardless of other states, top and left aligned at specified coordinates or at the location of the mouse event object.

Syntax

flyout.showAt(x, y);
flyout.showAt(mouseEventObj: MouseEvent);

Parameters

  • x
    Type: number

    Required. The x coordinate point where the top left corner of the Flyout will appear, relative to the top and left edge of the visual viewport.

  • y
    Type: number

    Required. The y coordinate point where the top left corner of the Flyout will appear, relative to the top and left edge of the visual viewport.

  • MouseEventObj
    Type: MouseEvent

    Required. The MouseEvent Object that specifies where to show the Flyout based on its location.

Return value

This method does not return a value.

Remarks

The showAt() method can be overloaded with either x,y coordinates or a mouse event object.

Examples

The following example shows how to use a Flyout as a context menu for Mouse/Pointer events.

window.oncontextmenu = function (e) {
    e.preventDefault();
    var flyout = document.querySelector("#myFlyout").winControl;
    flyout.showAt(e);
}

Requirements

Minimum WinJS version

WinJS 4.1

Namespace

WinJS.UI

See also

Flyout

Menu

MenuCommand

Displaying popups

Laying out your UI

HTML flyout control sample

Designers

Command patterns

Flyout

Guidelines for flyouts

Context menu

Guidelines for context menus