forked from mjackson/shadowbox
-
Notifications
You must be signed in to change notification settings - Fork 1
Options
Nerothos edited this page Nov 13, 2015
·
2 revisions
<p>The table below contains a list of options that may be used to configure Shadowbox.</p>
<table border="0" cellpadding="0" cellspacing="1">
<thead>
<tr><th>Option</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td>animate</td><td>Set this <code>false</code> to disable all fancy animations (except <a href="#animatefade">fades</a>). This can improve the overall effect on computers with poor performance. Defaults to <code>true</code>.</td></tr>
<tr><td><a name="animatefade">animateFade</a></td><td>Set this <code>false</code> to disable all fading animations. Defaults to <code>true</code>.</td></tr>
<tr><td><a name="animsequence">animSequence</a></td><td>The animation sequence to use when resizing Shadowbox. May be either <code>"wh"</code> (width first, then height), <code>"hw"</code> (height first, then width), or <code>"sync"</code> (both simultaneously). Defaults to <code>"sync"</code>.</td></tr>
<tr><td>autoplayMovies</td><td>Set this <code>false</code> to disable automatically playing movies when they are loaded. Defaults to <code>true</code>.</td></tr>
<tr><td><a name="continuous">continuous</a></td><td>Set this <code>true</code> to enable "continuous" galleries. By default, the galleries will not let a user go before the first image or after the last. Enabling this feature will let the user go directly to the first image in a gallery from the last one by selecting "Next". Defaults to <code>false</code>.</td></tr>
<tr><td>counterLimit</td><td>Limits the number of counter links that will be displayed in a "skip" <a href="#countertype">style counter</a>. If the actual number of gallery elements is greater than this value, the counter will be restrained to the elements immediately preceding and following the current element. Defaults to <code>10</code>.</td></tr>
<tr><td><a name="countertype">counterType</a></td><td>The mode to use for the gallery counter. May be either <code>"default"</code> or <code>"skip"</code>. The default counter is a simple "1 of 5" message. The skip counter displays a separate link to each piece in the gallery, enabling quick navigation in large galleries. Defaults to <code>"default"</code>.</td></tr>
<tr><td>displayCounter</td><td>Set this <code>false</code> to hide the gallery counter. Counters are never displayed on elements that are not part of a gallery. Defaults to <code>true</code>.</td></tr>
<tr><td>displayNav</td><td>Set this <code>false</code> to hide the gallery navigation controls. Defaults to <code>true</code>.</td></tr>
<tr><td>enableKeys</td><td>Set this false to disable keyboard navigation of galleries. Defaults to <code>true</code>.</td></tr>
<tr><td>fadeDuration</td><td>The duration (in seconds) of the fade animations. Defaults to <code>0.35</code>.</td></tr>
<tr><td>flashParams</td><td>A list of parameters (in a JavaScript object) that will be passed to a flash <code><object></code>. For a partial list of available parameters, see <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701">this page</a>. Only one parameter is specified by default: <code>bgcolor</code>. Defaults to <code>{bgcolor:"#000000"}</code>.</td></tr>
<tr><td>flashVars</td><td>A list of variables (in a JavaScript object) that will be passed to a flash movie as <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_16417">FlashVars</a>. Defaults to <code>{}</code>.</td></tr>
<tr><td>flashVersion</td><td>The minimum Flash version required to play a flash movie (as a string). Defaults to <code>"9.0.0"</code>.</td></tr>
<tr><td><a name="handleoversize">handleOversize</a></td><td>The mode to use for handling content that is too large for the viewport. May be one of <code>"none"</code>, <code>"resize"</code>, or <code>"drag"</code> (for images). The <code>"none"</code> setting will not alter the image dimensions, though clipping may occur. Setting this to <code>"resize"</code> enables on-the-fly resizing of large content. In this mode, the height and width of large, resizable content will be adjusted so that it may still be viewed in its entirety while maintaining its original aspect ratio. The <code>"drag"</code> mode will display an oversized image at its original resolution, but will allow the user to drag it within the view to see portions that may be clipped. See the <a href="index.html#lgimage-demo">demo</a> for a demonstration of all three modes of operation. Defaults to <code>"resize"</code>.</td></tr>
<tr><td><a name="handleunsupported">handleUnsupported</a></td><td>The mode to use for handling unsupported media. May be either <code>"link"</code> or <code>"remove"</code>. Media are unsupported when the browser plugin required to display the media properly is not installed. The link option will display a user-friendly error message with a link to a page where the needed plugin can be downloaded. The remove option will simply remove any unsupported gallery elements from the gallery before displaying it. With this option, if the element is not part of a gallery, the link will simply be followed. Defaults to <code>"link"</code>.</td></tr>
<tr><td><a name="initialheight">initialHeight</a></td><td>The height of Shadowbox (in pixels) when it first appears on the screen. Defaults to <code>160</code>.</td></tr>
<tr><td><a name="initialwidth">initialWidth</a></td><td>The width of Shadowbox (in pixels) when it first appears on the screen. Defaults to <code>320</code>.</td></tr>
<tr><td>modal</td><td>Set this <code>true</code> to prevent mouse clicks on the overlay from closing Shadowbox. Defaults to <code>false</code>.</td></tr>
<tr><td>onChange</td><td>A hook function that will be fired when Shadowbox changes from one gallery element to another. The single argument of this function will be the gallery element that is about to be displayed.</td></tr>
<tr><td>onClose</td><td>A hook function that will be fired when Shadowbox closes. The single argument of this function will be the gallery element that was last displayed.</td></tr>
<tr><td>onFinish</td><td>A hook function that will fire when Shadowbox finishes loading the current gallery piece (after all animations are complete). The single argument of this function will be the current gallery element.</td></tr>
<tr><td>onOpen</td><td>A hook function that will be fired when Shadowbox opens. The single argument of this function will be the current gallery element. Returning boolean <code>false</code> from this callback will prevent Shadowbox from opening.</td></tr>
<tr><td>overlayColor</td><td>The color to use for the modal overlay (in hex). Defaults to <code>"#000"</code>.</td></tr>
<tr><td>overlayOpacity</td><td>The opacity to use for the modal overlay. Defaults to <code>0.5</code>.</td></tr>
<tr><td>resizeDuration</td><td>The duration (in seconds) of the resizing animations. Defaults to <code>0.35</code>.</td></tr>
<tr><td>showOverlay</td><td>Determines whether the overlay will be shown at all. Defaults to <code>true</code>.</td></tr>
<tr><td>showMovieControls</td><td>Set this <code>false</code> to disable displaying QuickTime and Windows Media player movie control bars. Defaults to <code>true</code>.</td></tr>
<tr><td>skipSetup</td><td>Set this <code>true</code> to skip automatically calling <code>Shadowbox.setup</code> when Shadowbox initializes. Defaults to <code>true</code>.</td></tr>
<tr><td>slideshowDelay</td><td>A delay (in seconds) to use for slideshows. If set to anything other than 0, this value determines an interval at which Shadowbox will automatically proceed to the next piece in the gallery. Defaults to <code>0</code>.</td></tr>
<tr><td>troubleElements</td><td>An array of tag names of elements that should be hidden when a modal overlay is used. This option exists because some browsers are not able to display a semi-transparent overlay on top of these elements. These elements will have their visibility restored when Shadowbox closes. Defaults to <code>["select", "object", "embed", "canvas"]</code>.</td></tr>
<tr><td>viewportPadding</td><td>The amount of padding (in pixels) to maintain around the edge of the browser window. Defaults to <code>20</code>.</td></tr>
</tbody>
</table>
<p>Any of these options may be passed to <code>Shadowbox.init</code> in a JavaScript object, like this:</p>
<link rel="stylesheet" type="text/css" href="shadowbox.css">
<script type="text/javascript" src="shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init({
handleOversize: "drag",
displayNav: false,
handleUnsupported: "remove",
autoplayMovies: false
});
</script>
<p>If options are passed to <code>Shadowbox.init</code>, they will be applied as the default for all instances of Shadowbox on a page. However, options may also be used on a per-link basis as described on <a href="Usage">the usage page</a>.</p>
</div>