diff --git a/src/viewer.js b/src/viewer.js index 16a8659e..6d95515b 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -96,6 +96,12 @@ $.Viewer = function( options ) { //internal state and dom identifiers id: options.id, hash: options.hash || nextHash++, + /** + * If sequenceMode is true, display this page initially for the given tileSources. + * @member {Number} initialPage + * @memberof OpenSeadragon.Viewer# + */ + initialPage: 0, //dom nodes /** @@ -482,11 +488,13 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, * except for the index property; images are added in sequence. * A TileSource specifier is anything you could pass as the tileSource property * of the options parameter for {@link OpenSeadragon.Viewer#addTiledImage}. + * @param {Number} initialPage - If sequenceMode is true, display this page initially + * for the given tileSources. If specified, will overwrite the existing homonymous option. * @return {OpenSeadragon.Viewer} Chainable. * @fires OpenSeadragon.Viewer.event:open * @fires OpenSeadragon.Viewer.event:open-failed */ - open: function (tileSources) { + open: function (tileSources, initialPage) { var _this = this; this.close(); @@ -501,6 +509,10 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, this.referenceStrip = null; } + if (typeof initialPage != 'undefined' && !isNaN(initialPage)) { + this.initialPage = initialPage; + } + this.tileSources = tileSources; this._sequenceIndex = Math.max(0, Math.min(this.tileSources.length - 1, this.initialPage)); if (this.tileSources.length) {