Skip to contents

Creates a smooth fade transition between any two DIV elements by fading out one element and fading in another. This creates a polished user interface when switching between different elements like messages, panels, or content containers.

Usage

hide_and_show(hide_id, show_id, fade_time = 1)

Arguments

hide_id

Character string specifying the ID of the element to fade out

show_id

Character string specifying the ID of the element to fade in

fade_time

Numeric value specifying the duration of each fade animation in seconds (default: 1). The total transition time is twice the length (default: 1 x 2).

Details

The transition occurs in three steps:

  1. Ensures the target element exists in the DIV but is hidden

  2. Fades out the currently visible element

  3. After the fade-out completes, fades in the target element