Object: hsVariables
Functions
EventsObject: hs.ExpanderVariablesFunctionsEvents
|
hs.expandThe function used to open an image popup inline.
boolean hs.expand( DOMElement element [, Object overrides [, Object custom]] )
The hs.expand function is used to open an image popup from the If the "Unobtrusive" option is checked in the Configurator, the onclicks can be omitted alltogether, and Highslide anchors be identified by Details
Parameters
ExampleIn it's simplest formAll hs settings will be taken from the global definitions. <a class="highslide" href="../samples/full3.jpg" onclick="return hs.expand(this)"> <img src="../samples/thumb3.jpg" alt=""/> </a> The effect: Even simpler, using the unobtrusive markupAll hs settings will be taken from the global definitions. <a class="highslide" href="../samples/full3.jpg" rel="highslide"> <img src="../samples/thumb3.jpg" alt=""/> </a> The effect: Defining settings for a single expanderThe hs.outlineType and hs.targetX properties are overridden through the second argument of hs.expand. <a class="highslide" href="../samples/full3.jpg" onclick="return hs.expand(this, { outlineType: 'rounded-white', targetX: 'thumb1' })"> <img src="../samples/thumb3.jpg" alt=""/> </a> The effect: Passing custom variablesVariables passed through the third parameter of hs.expand can be accessed within the hs.Expander object. In this example the custom variable is alerted when the user clicks the "Click me" text in the caption. <a class="highslide" href="../samples/full3.jpg" onclick="return hs.expand(this, null, { myAlert: 'This is a custom variable' } )"> <img src="../samples/thumb3.jpg" alt=""/> </a> <div class="highslide-caption"> <h1 onclick="alert(hs.getExpander(this).custom.myAlert)">Click me</h1> </div> The effect: For another example of using the custom parameter, see hs.Expander.prototype.custom. Opening the expander from JavaScript without using an anchorThe first parameter of hs.expand is normally a reference to the opener anchor. When opening from JavaScript directly we don't have an opener anchor, so we pass hs.expand(null, { src: 'image1.jpg' }); See also |