aboutsummaryrefslogtreecommitdiff
path: root/js/reveal.js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2016-04-27 11:12:16 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2016-04-27 11:12:16 +0200
commit66c4e6a77fed49cf970ac306b50320f409abbc6b (patch)
tree74917fc9bff96c2abcf32db2b38f35aef3ae29a8 /js/reveal.js
parent539e774d31f91676bcc3f75e28168921cd27d819 (diff)
downloadfreenode-live-2017-presentation-66c4e6a77fed49cf970ac306b50320f409abbc6b.tar
freenode-live-2017-presentation-66c4e6a77fed49cf970ac306b50320f409abbc6b.tar.gz
use scrollHeight instead of custom measurement
Diffstat (limited to 'js/reveal.js')
-rw-r--r--js/reveal.js45
1 files changed, 4 insertions, 41 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 10c609e..8975504 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -589,7 +589,7 @@
var left = ( pageWidth - slideWidth ) / 2,
top = ( pageHeight - slideHeight ) / 2;
- var contentHeight = getAbsoluteHeight( slide );
+ var contentHeight = slide.scrollHeight;
var numberOfPages = Math.max( Math.ceil( contentHeight / pageHeight ), 1 );
// Center slides vertically
@@ -1291,41 +1291,6 @@
}
/**
- * Retrieves the height of the given element by looking
- * at the position and height of its immediate children.
- */
- function getAbsoluteHeight( element ) {
-
- var height = 0;
-
- if( element ) {
- var absoluteChildren = 0;
-
- toArray( element.childNodes ).forEach( function( child ) {
-
- if( typeof child.offsetTop === 'number' && child.style ) {
- // Count # of abs children
- if( window.getComputedStyle( child ).position === 'absolute' ) {
- absoluteChildren += 1;
- }
-
- height = Math.max( height, child.offsetTop + child.offsetHeight );
- }
-
- } );
-
- // If there are no absolute children, use offsetHeight
- if( absoluteChildren === 0 ) {
- height = element.offsetHeight;
- }
-
- }
-
- return height;
-
- }
-
- /**
* Returns the remaining height within the parent of the
* target element.
*
@@ -1589,10 +1554,8 @@
var size = getComputedSlideSize();
- var slidePadding = 20; // TODO Dig this out of DOM
-
// Layout the contents of the slides
- layoutSlideContents( config.width, config.height, slidePadding );
+ layoutSlideContents( config.width, config.height );
dom.slides.style.width = size.width + 'px';
dom.slides.style.height = size.height + 'px';
@@ -1654,7 +1617,7 @@
slide.style.top = 0;
}
else {
- slide.style.top = Math.max( ( ( size.height - getAbsoluteHeight( slide ) ) / 2 ) - slidePadding, 0 ) + 'px';
+ slide.style.top = Math.max( ( size.height - slide.scrollHeight ) / 2, 0 ) + 'px';
}
}
else {
@@ -1674,7 +1637,7 @@
* Applies layout logic to the contents of all slides in
* the presentation.
*/
- function layoutSlideContents( width, height, padding ) {
+ function layoutSlideContents( width, height ) {
// Handle sizing of elements with the 'stretch' class
toArray( dom.slides.querySelectorAll( 'section > .stretch' ) ).forEach( function( element ) {