VisibilityChangeEvent

From Documentation
Revision as of 11:07, 7 January 2022 by Hawk (talk | contribs) ((via JWB))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


VisibilityChangeEvent

VisibilityChangeEvent

Employment/Purpose

This event is fired when users change a browser page visibility e.g. switch to another tab or switch back. You should listen to this event on the root component of a page.

ZK implements it based on W3C page visibility.

Example

Basic

<window title="window" border="normal">
    <attribute name="onVisibilityChange">
        if (!event.isHidden())
        lbl.setValue("Welcome back");
    </attribute>
    <label id="lbl"></label>
</window>

Chatroom

In a chatroom application, you detect a user who switches to another tab, then notify other users. Please check the complete source.

Chatroom.png

Version History

Version Date Content
6.5.1 December 2, 2012 introduced in Control page visibility with HTML5 API in ZK



Last Update : 2022/01/07

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.