Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to swap source format. #298

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/galleria.js
Original file line number Diff line number Diff line change
Expand Up @@ -2397,6 +2397,7 @@ Galleria.prototype = {
dummy: undef, // 1.2.5
easing: 'galleria',
extend: function(options) {},
format: 'image',
fullscreenCrop: undef, // 1.2.5
fullscreenDoubleTap: true, // 1.2.4 toggles fullscreen on double-tap for touch devices
fullscreenTransition: undef, // 1.2.6
Expand Down Expand Up @@ -4529,8 +4530,8 @@ this.prependChild( 'info', 'myElement' );
if ( !data ) {
return;
}

var src = data.iframe || ( this.isFullscreen() && 'big' in data ? data.big : data.image ), // use big image if fullscreen mode
var src = data.iframe || ( this.isFullscreen() && 'big' in data ? data.big : data[this.getOptions('format')] ), // use big image if fullscreen mode
active = this._controls.getActive(),
next = this._controls.getNext(),
cached = next.isCached( src ),
Expand Down Expand Up @@ -4890,14 +4891,26 @@ this.prependChild( 'info', 'myElement' );
return this._stageWidth;
},

/**
Specify source format to diplay. Data must contains the specified format

@param {string} format Format to use

*/
setFormat : function(format){
format = format == undefined ? "image" : format;
this.setOptions('format', format);
//this._options.format = format;
this.show(this._active);
},

/**
Retrieve the option

@param {string} key The option key to retrieve. If no key specified it will return all options in an object.

@returns option or options
*/

getOptions : function( key ) {
return typeof key === 'undefined' ? this._options : this._options[ key ];
},
Expand Down