Compare commits

...

11 Commits

Author SHA1 Message Date
Hakim El Hattab 38b11a4d8e only offset slides vertically when center option is true 2014-04-22 20:07:17 +02:00
Hakim El Hattab 685b833e56 Merge branch 'dev' of github.com:hakimel/reveal.js into flexbox 2014-04-22 19:02:20 +02:00
Hakim El Hattab dfcd60896b merge dev into flexbox 2014-04-22 16:57:54 +02:00
Hakim El Hattab 7f5361fdba offset slides toward perceived center 2014-04-20 11:34:50 +02:00
Hakim El Hattab 5bab3c4fa0 merge dev into flexbox 2014-04-20 11:25:04 +02:00
Hakim El Hattab 939af263ce fall back on js centering when flexbox is not supported 2014-04-04 11:56:31 +02:00
Hakim El Hattab 90539cff2c merge dev into flexbox 2014-04-04 11:36:50 +02:00
Hakim El Hattab 328754be58 use flexbox to vertically center slides 2014-04-03 12:14:58 +02:00
Hakim El Hattab 3144dbefbd merge dev into flexbox 2014-04-03 11:59:33 +02:00
Hakim El Hattab 54195e3c6b basic flexbox styles 2014-04-03 11:20:42 +02:00
Hakim El Hattab 99396735a0 control slide visibility through class instead of style 2014-04-03 11:10:54 +02:00
2 changed files with 65 additions and 31 deletions

View File

@ -370,7 +370,7 @@ body {
}
.reveal table {
margin: auto;
margin: 0 auto;
border-collapse: collapse;
border-spacing: 0;
}
@ -594,7 +594,7 @@ body {
display: none;
position: absolute;
width: 100%;
padding: 20px 0px;
padding: 0px;
z-index: 10;
line-height: 1.2em;
@ -619,6 +619,49 @@ body {
opacity 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
}
.reveal .slides>section.visible,
.reveal .slides>section>section.visible {
display: block;
}
.reveal.center .slides {
top: -40px;
}
.reveal.center .slides,
.reveal.center .slides section {
height: 100%;
}
.reveal.center .slides section:not(.stack) {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-direction: normal;
-webkit-box-orient: vertical;
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
-moz-align-items: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
-moz-justify-content: center;
justify-content: center;
}
/* Global transition speed settings */
.reveal[data-transition-speed="fast"] .slides section {
-webkit-transition-duration: 400ms;
@ -643,24 +686,12 @@ body {
transition-duration: 1200ms;
}
.reveal .slides>section.stack {
padding-top: 0;
padding-bottom: 0;
}
.reveal .slides>section.present,
.reveal .slides>section>section.present {
display: block;
z-index: 11;
opacity: 1;
}
.reveal.center,
.reveal.center .slides,
.reveal.center .slides section {
min-height: auto !important;
}
/* Don't allow interaction with invisible slides */
.reveal .slides>section.future,
.reveal .slides>section>section.future,
@ -1162,7 +1193,6 @@ body {
}
.reveal.overview .slides section {
height: 600px;
overflow: hidden;
opacity: 1 !important;
visibility: visible !important;

View File

@ -1178,25 +1178,29 @@ var Reveal = (function(){
for( var i = 0, len = slides.length; i < len; i++ ) {
var slide = slides[ i ];
var style = window.getComputedStyle( slide );
// Don't bother updating invisible slides
if( slide.style.display === 'none' ) {
// Don't update invisible slides
if( style.display === 'none' ) {
continue;
}
if( config.center || slide.classList.contains( 'center' ) ) {
// Vertical stacks are not centred since their section
// children will be
if( slide.classList.contains( 'stack' ) ) {
slide.style.top = 0;
// If the display mode is 'block' flexbox is not supported by
// the current browser so we fall back on JavaScript centering
else if( style.display === 'block' ) {
if( config.center || slide.classList.contains( 'center' ) ) {
// Vertical stacks are not centred since their section children will be
if( slide.classList.contains( 'stack' ) ) {
slide.style.top = 0;
}
else {
slide.style.top = Math.max( ( ( slideHeight - getAbsoluteHeight( slide ) ) / 2 ) - slidePadding, 0 ) + 'px';
slide.style.height = 'auto';
}
}
else {
slide.style.top = Math.max( ( ( slideHeight - getAbsoluteHeight( slide ) ) / 2 ) - slidePadding, 0 ) + 'px';
slide.style.top = '';
}
}
else {
slide.style.top = '';
}
}
@ -1926,11 +1930,11 @@ var Reveal = (function(){
// Show the horizontal slide if it's within the view distance
if( distanceX < viewDistance ) {
horizontalSlide.style.display = 'block';
horizontalSlide.classList.add( 'visible' );
loadSlide( horizontalSlide );
}
else {
horizontalSlide.style.display = 'none';
horizontalSlide.classList.remove( 'visible' );
}
if( verticalSlidesLength ) {
@ -1943,11 +1947,11 @@ var Reveal = (function(){
distanceY = x === indexh ? Math.abs( indexv - y ) : Math.abs( y - oy );
if( distanceX + distanceY < viewDistance ) {
verticalSlide.style.display = 'block';
verticalSlide.classList.add( 'visible' );
loadSlide( verticalSlide );
}
else {
verticalSlide.style.display = 'none';
verticalSlide.classList.remove( 'visible' );
}
}