install menu and attribution plugins, update amical.html to use
This commit is contained in:
committed by
Kathleen Fitzpatrick
parent
962a3ab3cf
commit
306d654274
75
plugin/attribution/plugin.js
Normal file
75
plugin/attribution/plugin.js
Normal file
@@ -0,0 +1,75 @@
|
||||
/*****************************************************************
|
||||
** Author: Roland Schmehl, r.schmehl@tudelft.nl
|
||||
**
|
||||
** A plugin for displaying attribution texts sideways along the right
|
||||
** edge of the viewport. When resizing the viewport or toggling full
|
||||
** screen mode, the attribution text sticks persistently to the right
|
||||
** edge of the viewport.
|
||||
**
|
||||
** The dynamic scaling of the attribution text via CSS transform
|
||||
** is adopted from the fullscreen plugin.
|
||||
**
|
||||
** Version: 1.0
|
||||
**
|
||||
** License: MIT license (see file LICENSE)
|
||||
**
|
||||
******************************************************************/
|
||||
|
||||
window.RevealAttribution = window.RevealAttribution || {
|
||||
id: 'RevealAttribution',
|
||||
init: function(deck) {
|
||||
initAttribution(deck);
|
||||
}
|
||||
};
|
||||
|
||||
const initAttribution = function(Reveal){
|
||||
|
||||
var ready = false;
|
||||
var resize = false;
|
||||
var scale = 1;
|
||||
|
||||
window.addEventListener( 'ready', function( event ) {
|
||||
|
||||
var content;
|
||||
|
||||
// Remove configured margin of the presentation
|
||||
var attribution = document.getElementsByClassName("attribution");
|
||||
var width = window.innerWidth;
|
||||
var configuredWidth = Reveal.getConfig().width;
|
||||
var configuredHeight = Reveal.getConfig().height;
|
||||
|
||||
scale = 1/(1-Reveal.getConfig().margin);
|
||||
|
||||
for (var i = 0; i < attribution.length; i++) {
|
||||
content = attribution[i].innerHTML;
|
||||
attribution[i].style.width = configuredWidth + "px";
|
||||
attribution[i].style.height = configuredHeight + "px";
|
||||
attribution[i].innerHTML = "<span class='content'>" + content + "</span>";
|
||||
attribution[i].style.transform = 'translate( -50%, -50% ) scale( ' + scale*100 + '% ) rotate(-180deg)';
|
||||
}
|
||||
|
||||
// Scale with cover class to mimic backgroundSize cover
|
||||
resizeCover();
|
||||
|
||||
});
|
||||
|
||||
window.addEventListener( 'resize', resizeCover );
|
||||
|
||||
function resizeCover() {
|
||||
|
||||
// Scale to mimic backgroundSize cover
|
||||
var attribution = document.getElementsByClassName("attribution");
|
||||
var xScale = window.innerWidth / Reveal.getConfig().width;
|
||||
var yScale = window.innerHeight / Reveal.getConfig().height;
|
||||
var s = 1;
|
||||
|
||||
if (xScale > yScale) {
|
||||
// The div fits perfectly in x axis, stretched in y
|
||||
s = xScale/yScale;
|
||||
}
|
||||
for (var i = 0; i < attribution.length; i++) {
|
||||
attribution[i].style.transform = 'translate( -50%, -50% ) scale( ' + s*scale*100 + '% ) rotate(-180deg)';
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user