Sequence and Collection Modes
Take a look at two modes that help you arrange multiple images
In the previous lesson, you created a simple OpenSeadragon viewer with a single image. Sometimes, that's all you need, but often, you'll want to present multiple images. In this lesson, you'll discover two ways to do that: sequence mode and collection mode.
Adding More Images#
OpenSeadragon provides a couple of straightforward modes for displaying multiple images. You may have noticed that the tile source option property is named tileSources
, which suggests you can load more than one at a time. So far, you've only been putting a single tile source in there, but in fact, you can give it an array instead.
Here's another image URL, but feel free to use your own:
https://images.unsplash.com/photo-1494500764479-0c8f2919a3d8
Here it is, along with the other image:
xxxxxxxxxx
tileSources: [
{
type: 'image',
url: 'https://images.unsplash.com/photo-1501785888041-af3ef285b470'
},
{
type: 'image',
url: 'https://images.unsplash.com/photo-1494500764479-0c8f2919a3d8'
}
]
If you run it, you'll see only the new image, not the original one. This is because they are stacked on top of each other. You'll delve into rearranging images in a future module, but in the meantime, there are some simple helpers for automatically arranging them or stepping through them.
Sequence Mode#
If you add sequenceMode: true
to your options, the viewer will display one image at a time, with buttons that allow the user to go from one image to another. Give it a try!
Collection Mode#
This lesson preview is part of the OpenSeadragon Deep Dive course and can be unlocked immediately with a \newline Pro subscription or a single-time purchase. Already have access to this course? Log in here.
Get unlimited access to OpenSeadragon Deep Dive, plus 70+ \newline books, guides and courses with the \newline Pro subscription.
