You are here

function popup_popup_effects in Popup 7

Same name and namespace in other branches
  1. 7.x popup.module \popup_popup_effects()
  2. 6.x popup.module \popup_popup_effects()

Implementation of hook_popup_effects

This hook allows modules to supply Javascript methods for showing/hiding popups.

Return value

a keyed array

in the form:

array( 'show' => array( 'effect-name' => 'javascript to show the popup', ... ), 'hide' => array( 'effect-name' => 'javascript to hide the popup' ... ), );

The Javascript is executed within the context of the PopupElement wrapper ojbect. The following properties are available as JQuery objects:

element: The popup element wrapper title: the title element of the popup body: the body element of the popup. Keep in mind that the body is no longer contained within the popup element wrapper, but within its own wrapper within the #popup-active-overlay element at the end of the HTML body. wrapper: Wrapper of the popup element body. This has the same id as the popup element, with "-active" appended. origin: Invisible div element prepended to the element wrapper, to establish the popup top/left offset in relation to the document.

File

./popup.module, line 75

Code

function popup_popup_effects() {
  return array(
    'show' => array(
      'default' => "this.body.show();",
      'fade' => "\n        if (this.opacity){\n          this.body.fadeTo('medium',this.opacity);\n        }else{\n          this.body.fadeIn('medium');\n        }",
      'slide-down' => "this.body.slideDown('medium')",
      'slide-down-fade' => "\n        this.body.animate(\n          {\n            height:'show',\n            opacity:(this.opacity ? this.opacity : 'show')\n          }, 'medium'\n        );",
    ),
    'hide' => array(
      'default' => "this.body.hide();",
      'fade' => "this.body.fadeOut('medium');",
      'slide-down' => "this.body.slideUp('medium');",
      'slide-down-fade' => "\n        this.body.animate(\n          {\n            height:'hide',\n            opacity:'hide'\n          }, 'medium'\n        );",
    ),
  );
}