adjust controls layout when there are no vertical or horizontal slides in the deck

This commit is contained in:
Hakim El Hattab 2017-05-16 09:43:16 +02:00
parent f8b5813e59
commit 58dc6b7c36
3 changed files with 170 additions and 201 deletions

File diff suppressed because one or more lines are too long

View File

@ -236,13 +236,14 @@ body {
*********************************************/ *********************************************/
.reveal .controls { .reveal .controls {
$size: 52px; $size: 46px;
$length: floor($size * 0.6); $length: floor($size * 0.7);
$spacing: 8px;
$thickness: 6px; $thickness: 6px;
$angle: 44deg; $angle: 44deg;
$angleHover: 40deg; $angleHover: 40deg;
$angleActive: 36deg; $angleActive: 36deg;
$spacing: 12px;
$innerSpacing: 18px;
@mixin arrowTransform( $angle ) { @mixin arrowTransform( $angle ) {
&:before { &:before {
@ -256,10 +257,10 @@ body {
display: none; display: none;
position: absolute; position: absolute;
top: 0; top: auto;
right: 0; bottom: $spacing;
bottom: 0; right: $spacing;
left: 0; left: auto;
z-index: 1; z-index: 1;
color: #fff; color: #fff;
pointer-events: none; pointer-events: none;
@ -315,26 +316,26 @@ body {
} }
.navigate-left { .navigate-left {
top: 50%; right: $size + $innerSpacing*2;
left: $spacing; bottom: $innerSpacing;
transform: translateY(-50%); transform: translateY(-50%);
} }
.navigate-right { .navigate-right {
top: 50%; right: 0;
right: $spacing; bottom: $innerSpacing;
transform: translateY(-50%) rotate( 180deg ); transform: translateY(-50%) rotate( 180deg );
} }
.navigate-up { .navigate-up {
top: $spacing; right: $innerSpacing;
left: 50%; bottom: $size + $innerSpacing*2;
transform: translateX(-50%) rotate( 90deg ); transform: translateX(-50%) rotate( 90deg );
} }
.navigate-down { .navigate-down {
bottom: $spacing; right: $innerSpacing;
left: 50%; bottom: 0;
transform: translateX(-50%) rotate( -90deg ); transform: translateX(-50%) rotate( -90deg );
} }
@ -376,52 +377,59 @@ body {
opacity: 1; opacity: 1;
} }
@mixin bottom-right-controls() { @media screen and (min-width: 500px) {
$spacing: 12px;
$innerSpacing: 20px;
$spacing: 8px;
&[data-controls-layout="edges"] {
& { & {
top: auto; top: 0;
bottom: $spacing; right: 0;
right: $spacing; bottom: 0;
left: auto; left: 0;
transform: scale(0.85);
transform-origin: 100% 100%;
} }
.navigate-left, .navigate-left,
.navigate-right, .navigate-right,
.navigate-up, .navigate-up,
.navigate-down { .navigate-down {
top: auto; bottom: auto;
left: auto; right: auto;
} }
.navigate-left { .navigate-left {
right: $size + $innerSpacing*2; top: 50%;
bottom: $innerSpacing; left: $spacing;
} }
.navigate-right { .navigate-right {
right: 0; top: 50%;
bottom: $innerSpacing; right: $spacing;
} }
.navigate-up { .navigate-up {
right: $innerSpacing; top: $spacing;
bottom: $size + $innerSpacing*2; left: 50%;
} }
.navigate-down { .navigate-down {
right: $innerSpacing; bottom: $spacing;
left: 50%;
}
}
}
}
// Adjust the layout when there are no vertical slides
.reveal:not(.has-vertical-slides) .controls .navigate-left,
.reveal:not(.has-vertical-slides) .controls .navigate-right {
bottom: 0; bottom: 0;
} }
}
&[data-controls-layout="bottom-right"] { .reveal:not(.has-horizontal-slides) .controls .navigate-up,
@include bottom-right-controls() .reveal:not(.has-horizontal-slides) .controls .navigate-down {
} right: 0;
@media screen and (max-width: 500px) {
@include bottom-right-controls()
}
} }
.reveal.has-dark-background .controls button:after, .reveal.has-dark-background .controls button:after,

View File

@ -2739,6 +2739,22 @@
} }
} }
// Flag if there are ANY vertical slides, anywhere in the deck
if( dom.wrapper.querySelectorAll( '.slides>section>section' ).length ) {
dom.wrapper.classList.add( 'has-vertical-slides' );
}
else {
dom.wrapper.classList.remove( 'has-vertical-slides' );
}
// Flag if there are ANY horizontal slides, anywhere in the deck
if( dom.wrapper.querySelectorAll( '.slides>section:not(.stack)' ).length ) {
dom.wrapper.classList.add( 'has-horizontal-slides' );
}
else {
dom.wrapper.classList.remove( 'has-horizontal-slides' );
}
} }
} }