Toggle Galleria Full Screen Mode

Dany Khalife picture Dany Khalife · Feb 15, 2012 · Viewed 13.9k times · Source

I am wondering if anyone knows how to toggle between full screen and normal mode in Galleria

The only way I can think of is to switch between themes : default, and Fullscreen theme (which i bought from there)

If you know an even better way, I would appreciate your help.

Answer

David Hellsing picture David Hellsing · Feb 16, 2012

I’m just going to add to @Ohgodwhy’s answer:

The best way to get the Galleria instance and use the API is to use the Galleria.ready function:

Galleria.ready(function() {
  var gallery = this; // galleria is ready and the gallery is assigned
  $('#fullscreen').click(function() {
    gallery.toggleFullscreen(); // toggles the fullscreen
  });
});

Or, you can access the instance via the $.data object if you know that the gallery is initialized:

$('#fullscreen').click(function() {
  $('#galleria').data('galleria').toggleFullscreen(); // toggles the fullscreen
});

I am assuming you have a link/button with the ID 'fullscreen' and the gallery is at ID 'galleria'.