onResize - Resize Script

Activates JavaScript code when the width or height of the browser has changed.

Category

events

Syntax

<xp:eventHandler event="onResize" attributes>content</xp:eventHandler>

Usage

In Design mode, click All Properties and look for onResize in theevents category.

This event can be used to find whether the width and height dimensions are now in portrait or landscape ratios.

Available for the Single Page Application control.

Note: This event is new for Release 9.0.1

In mobile applications, the onResize event is often used in conjunction with the onOrientationChange event to make layout changes when the user rotates the device. The window object can be inspected to find the width and height. For testing purposes, it may be useful to note that the onResize event will also trigger in a desktop browser if the user resizes the web browser window.

Examples

<xe:singlePageApp>
	<xp:eventHandler event="onResize" submit="false">
		<xe:this.script><![CDATA[console.log("onResize "
    +"innerWidth:"+window.innerWidth+" innerHeight:"+window.innerHeight);]]&gt;</xe:this.script>
	</xp:eventHandler>
</xe:singlePageApp>