Overview
This article explains the implementation for dynamically specifying the viewingDirection of the Mirador viewer via URL parameters. This feature allows the same manifest to be displayed left-to-right or right-to-left.
Implementation
1. Retrieving URL Parameters
Retrieve the viewingDirection parameter from the URL and set a default value:
In this implementation, when no parameter is specified, 'right-to-left' is used as the default.
2. Applying to Mirador Configuration
Incorporate the retrieved viewingDirection into the Mirador initial configuration:
3. Usage Examples
Right-to-Left Display (Default)
or
Left-to-Right Display
XSLT Implementation
When implementing this feature within an XSLT template, add the following code to the script section (mirador.xsl:222-230):
Available Values
The following values can be used for Mirador’s viewingDirection:
left-to-right- Pages turn from left to right (e.g., Western books)right-to-left- Pages turn from right to left (e.g., Japanese books, Arabic books)top-to-bottom- Top to bottom (e.g., scrolls)bottom-to-top- Bottom to top
Notes
- If
viewingDirectionis specified in the manifest file, the manifest setting takes priority. This method is primarily effective when the viewing direction is not specified in the manifest file - This setting is applied per window
- URL parameters are evaluated only at page load time
- If the user changes the viewing direction through the Mirador UI, the URL parameter value is overwritten
Related Files
xsl/mirador.xsl- XSLT transformation template (implementation location)