Object: hsVariables
Functions
EventsObject: hs.ExpanderVariablesFunctionsEvents
|
hs.Expander.prototype.createOverlayCreate a custom overlay for a single expander instance
void hs.Expander.prototype.createOverlay ( object options)
Using this function in combination with the onBeforeExpand event handler lets you create a specific overlay for each expander on the fly without defining it in your page's content. If you want to add more overlays than the heading and caption can offer, you can use this option.
Details
Parameters
ExampleDisplay a custom text in the overlaySince version 4.0 this is more easily done using a regular heading, but the example is kept for reference. This example shows how to create an instance specific overlay without defining it in the HTML of your page, then populate it with content. Note that this approach requires that you use a Highslide configuration with the events component. Put the following code in the head section of your HTML page or in a separate .js file. <style type="text/css"> /* Define some presentational styles for the overlay */ .highslide-overlay { text-align: center; background: black; font-weight: bold; font-size: 150%; color: white; padding: 10px; } </style> <script type="text/javascript"> hs.Expander.prototype.onBeforeExpand = function (sender, e) { // create a new DOM element var div = document.createElement('div'); // add a class name to allow CSS styling div.className = "highslide-overlay"; // use the thumbnail's alt attribute as inner HTML div.innerHTML = sender.thumb.alt; // attatch it to this hs.Expander instance and add some options sender.createOverlay( { overlayId: div, position: "top left", hideOnMouseOut: true, opacity: 0.8, width: '100%' } ); } </script> This is the effect of the above: See also |