hs.getExpander
Get a hs.Expander object by id, by a DOM element or get the active expander.
hs.Expander hs.getExpander ( [mixed param] )
The getExpander function is designed to return the correct element almost whatever you throw at it, as shown below.
Details
Type |
function |
Returns |
hs.Expander |
Parameters
- param
-
- If param is
null
, the function returns the currently active (focused) element or null
if no expander is open.
- If param is a string, the function first looks for elements by that id within an opened expander and returns that expander. If that fails, the function looks for an anchor by that id or a thumbnail image by that id and returns the expander that this thumbnail has opened. If these two cases fail, it returns
null
.
- If param is a DOM element, the function looks for suiting elements by the same rules as if it were a string.
Example
Getting hs.Expander info from the caption
In this case this refers to the h1 element itself, and getExpander returns the hs.Expander the caption is a part of. It alerts the href attribute of the anchor that opened the hs.Expander.
<div class="highslide-caption">
<h1 onclick="alert(hs.getExpander(this).a.href)">Click me</h1>
</div>
Try it
Click me