overview now works with percentage based width/height #1247
parent
cb092e60bf
commit
5dd9067150
|
@ -20,7 +20,7 @@ html, body, .reveal div, .reveal span, .reveal applet, .reveal object, .reveal i
|
||||||
.reveal article, .reveal aside, .reveal canvas, .reveal details, .reveal embed,
|
.reveal article, .reveal aside, .reveal canvas, .reveal details, .reveal embed,
|
||||||
.reveal figure, .reveal figcaption, .reveal footer, .reveal header, .reveal hgroup,
|
.reveal figure, .reveal figcaption, .reveal footer, .reveal header, .reveal hgroup,
|
||||||
.reveal menu, .reveal nav, .reveal output, .reveal ruby, .reveal section, .reveal summary,
|
.reveal menu, .reveal nav, .reveal output, .reveal ruby, .reveal section, .reveal summary,
|
||||||
.reveal time, .reveal mark, .reveal audio, video {
|
.reveal time, .reveal mark, .reveal audio, .reveal video {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
|
@ -989,7 +989,8 @@ html:-moz-full-screen-ancestor {
|
||||||
-webkit-perspective: 700px;
|
-webkit-perspective: 700px;
|
||||||
perspective: 700px; }
|
perspective: 700px; }
|
||||||
.reveal.overview .slides section {
|
.reveal.overview .slides section {
|
||||||
height: 700px;
|
height: 100%;
|
||||||
|
top: 0 !important;
|
||||||
opacity: 1 !important;
|
opacity: 1 !important;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
visibility: visible !important;
|
visibility: visible !important;
|
||||||
|
|
|
@ -1022,7 +1022,8 @@ html:-moz-full-screen-ancestor {
|
||||||
perspective: 700px;
|
perspective: 700px;
|
||||||
|
|
||||||
.slides section {
|
.slides section {
|
||||||
height: 700px;
|
height: 100%;
|
||||||
|
top: 0 !important;
|
||||||
opacity: 1 !important;
|
opacity: 1 !important;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
visibility: visible !important;
|
visibility: visible !important;
|
||||||
|
|
45
js/reveal.js
45
js/reveal.js
|
@ -166,6 +166,10 @@
|
||||||
// Flags if the overview mode is currently active
|
// Flags if the overview mode is currently active
|
||||||
overview = false,
|
overview = false,
|
||||||
|
|
||||||
|
// Holds the dimensions of our overview slides, including margins
|
||||||
|
overviewSlideWidth = null,
|
||||||
|
overviewSlideHeight = null,
|
||||||
|
|
||||||
// The horizontal and vertical index of the currently active slide
|
// The horizontal and vertical index of the currently active slide
|
||||||
indexh,
|
indexh,
|
||||||
indexv,
|
indexv,
|
||||||
|
@ -1798,6 +1802,17 @@
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
// Calculate slide sizes
|
||||||
|
var margin = 70;
|
||||||
|
var slideSize = getComputedSlideSize();
|
||||||
|
overviewSlideWidth = slideSize.width + margin;
|
||||||
|
overviewSlideHeight = slideSize.height + margin;
|
||||||
|
|
||||||
|
// Reverse in RTL mode
|
||||||
|
if( config.rtl ) {
|
||||||
|
overviewSlideWidth = -overviewSlideWidth;
|
||||||
|
}
|
||||||
|
|
||||||
updateSlidesVisibility();
|
updateSlidesVisibility();
|
||||||
layoutOverview();
|
layoutOverview();
|
||||||
updateOverview();
|
updateOverview();
|
||||||
|
@ -1821,19 +1836,10 @@
|
||||||
*/
|
*/
|
||||||
function layoutOverview() {
|
function layoutOverview() {
|
||||||
|
|
||||||
var margin = 70;
|
|
||||||
var slideWidth = config.width + margin,
|
|
||||||
slideHeight = config.height + margin;
|
|
||||||
|
|
||||||
// Reverse in RTL mode
|
|
||||||
if( config.rtl ) {
|
|
||||||
slideWidth = -slideWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Layout slides
|
// Layout slides
|
||||||
toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( hslide, h ) {
|
toArray( dom.wrapper.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ).forEach( function( hslide, h ) {
|
||||||
hslide.setAttribute( 'data-index-h', h );
|
hslide.setAttribute( 'data-index-h', h );
|
||||||
transformElement( hslide, 'translate3d(' + ( h * slideWidth ) + 'px, 0, 0)' );
|
transformElement( hslide, 'translate3d(' + ( h * overviewSlideWidth ) + 'px, 0, 0)' );
|
||||||
|
|
||||||
if( hslide.classList.contains( 'stack' ) ) {
|
if( hslide.classList.contains( 'stack' ) ) {
|
||||||
|
|
||||||
|
@ -1841,7 +1847,7 @@
|
||||||
vslide.setAttribute( 'data-index-h', h );
|
vslide.setAttribute( 'data-index-h', h );
|
||||||
vslide.setAttribute( 'data-index-v', v );
|
vslide.setAttribute( 'data-index-v', v );
|
||||||
|
|
||||||
transformElement( vslide, 'translate3d(0, ' + ( v * slideHeight ) + 'px, 0)' );
|
transformElement( vslide, 'translate3d(0, ' + ( v * overviewSlideHeight ) + 'px, 0)' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1849,10 +1855,10 @@
|
||||||
|
|
||||||
// Layout slide backgrounds
|
// Layout slide backgrounds
|
||||||
toArray( dom.background.childNodes ).forEach( function( hbackground, h ) {
|
toArray( dom.background.childNodes ).forEach( function( hbackground, h ) {
|
||||||
transformElement( hbackground, 'translate3d(' + ( h * slideWidth ) + 'px, 0, 0)' );
|
transformElement( hbackground, 'translate3d(' + ( h * overviewSlideWidth ) + 'px, 0, 0)' );
|
||||||
|
|
||||||
toArray( hbackground.querySelectorAll( '.slide-background' ) ).forEach( function( vbackground, v ) {
|
toArray( hbackground.querySelectorAll( '.slide-background' ) ).forEach( function( vbackground, v ) {
|
||||||
transformElement( vbackground, 'translate3d(0, ' + ( v * slideHeight ) + 'px, 0)' );
|
transformElement( vbackground, 'translate3d(0, ' + ( v * overviewSlideHeight ) + 'px, 0)' );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
@ -1864,19 +1870,10 @@
|
||||||
*/
|
*/
|
||||||
function updateOverview() {
|
function updateOverview() {
|
||||||
|
|
||||||
var margin = 70;
|
|
||||||
var slideWidth = config.width + margin,
|
|
||||||
slideHeight = config.height + margin;
|
|
||||||
|
|
||||||
// Reverse in RTL mode
|
|
||||||
if( config.rtl ) {
|
|
||||||
slideWidth = -slideWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
transformSlides( {
|
transformSlides( {
|
||||||
overview: [
|
overview: [
|
||||||
'translateX('+ ( -indexh * slideWidth ) +'px)',
|
'translateX('+ ( -indexh * overviewSlideWidth ) +'px)',
|
||||||
'translateY('+ ( -indexv * slideHeight ) +'px)',
|
'translateY('+ ( -indexv * overviewSlideHeight ) +'px)',
|
||||||
'translateZ('+ ( window.innerWidth < 400 ? -1000 : -2500 ) +'px)'
|
'translateZ('+ ( window.innerWidth < 400 ? -1000 : -2500 ) +'px)'
|
||||||
].join( ' ' )
|
].join( ' ' )
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in New Issue