These projects are retired. The development has stopped and we don't provide support for them anymore.

Window related functions

Name

Window -- browser independent access to window related functions.

Synopsis

<SCRIPT LANGUAGE="JavaScript1.2" SRC="scripts/rl_window.js"</SCRIPT>
                  

Requires

Browser detection

Utility functions and classes

Functions

boolean hook ( );
void addLoadHook ( Function loadHook, integer position );
void addResizeHook ( Function resizeHook, integer position );
integer getWindowWidth ( );
integer getWindowHeight ( );
void nextHook ( );

Description

Makes it possible to register multiple hooks that are executed when the window has finished loaded or has been resized.

Provides browser independent access to the window dimensions.

Details

Following is a detailed description of the elements listed in the synopsis.

Functions

hook
     A hook function is meant to be executed in the middle of the normal flow of a certain operation. Normally a hook function always has to return true. This means that after it has returned, the next hook in the queue will be executed. If false is returned, the execution of the next hooks is halted and has to be explicitly resumed with the nextHook function. This functionality is typically used to allow hooks to work with timeouts to themselves. This makes it possible to wait for another action to be finished before continuing.

Returns

true
after the hook returns, the next hook function in the queue will be executed.
false
after the hook returns, the execution of the next hook function will be halted until nextHook is called.

addLoadHook
     Registers the provided loadHook function so that it will be executed when the window has finished loading. The hooks will be executed in the order of the position parameter that was provided.

Parameters

loadHook
the hook function that will be executed after the document has finished loading.
position
the position that indicates the order in which the hooks will be executed. If this parameter is omitted, the hook will be added to the end of the queue.

addResizeHook
     Registers the provided resizeHook function so that it will be executed when the window has been resized. The hooks will be executed in the order of the position parameter that was provided.

Parameters

loadHook
the hook function that will be executed after the window has been resized.
position
the position that indicates the order in which the hooks will be executed. If this parameter is omitted, the hook will be added to the end of the queue.

getWindowWidth
     Returns an internal width of the window.

Returns

integer
the internal width of the window.

getWindowHeight
     Returns the internal height of the window.

Returns

integer
the internal height of the window.

nextHook
     This function has to be called by a hook function if it has explicitly stopped the execution of the next hooks by returning false. Care has to be taken that this is always called when its needed, otherwise the execution of all RelativeLayer scripts will be halted.