35 lines
956 B
JavaScript
35 lines
956 B
JavaScript
/**
|
|
* Resize plugin
|
|
*
|
|
* Rescale the presentation after a window resize.
|
|
*
|
|
* Copyright 2011-2012 Bartek Szopka (@bartaz)
|
|
* Released under the MIT license.
|
|
* ------------------------------------------------
|
|
* author: Bartek Szopka
|
|
* version: 0.5.3
|
|
* url: http://bartaz.github.com/impress.js/
|
|
* source: http://github.com/bartaz/impress.js/
|
|
*
|
|
*/
|
|
|
|
/* global document, window */
|
|
|
|
( function( document, window ) {
|
|
"use strict";
|
|
|
|
// Wait for impress.js to be initialized
|
|
document.addEventListener( "impress:init", function( event ) {
|
|
var api = event.detail.api;
|
|
|
|
// Rescale presentation when window is resized
|
|
api.lib.gc.addEventListener( window, "resize", api.lib.util.throttle( function() {
|
|
|
|
// Force going to active step again, to trigger rescaling
|
|
api.goto( document.querySelector( ".step.active" ), 500 );
|
|
}, 250 ), false );
|
|
}, false );
|
|
|
|
} )( document, window );
|
|
|