Skip to content

Commit

Permalink
don't show reader scroll bar when there is no overflow, reader style …
Browse files Browse the repository at this point in the history
…tweaks
  • Loading branch information
hakimel committed Oct 17, 2023
1 parent 836967d commit c4e322c
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 31 deletions.
30 changes: 16 additions & 14 deletions css/reveal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1882,8 +1882,9 @@ $notesWidthPercent: 25%;
overflow-y: auto;
z-index: 1;

--r-reader-progress-width: 8px;
--r-reader-progress-width: 7px;
--r-reader-progress-trigger-size: 5px;
--r-controls-spacing: 8px;
}

@media screen and (max-width: 500px) {
Expand Down Expand Up @@ -2015,18 +2016,6 @@ $notesWidthPercent: 25%;
z-index: 10;
}

// Hit area
.reader-progress-inner:after {
content: '';
position: absolute;
width: 200%;
height: 100%;
top: 0;
left: -50%;
background: rgba( 0, 0, 0, 0 );
z-index: -1;
}

.reader-progress-playhead {
position: absolute;
width: var(--r-reader-progress-width);
Expand All @@ -2036,7 +2025,7 @@ $notesWidthPercent: 25%;
border-radius: var(--r-reader-progress-width);
background-color: rgba(var(--r-overlay-element-bg-color), 1);
z-index: 11;
transition: background-color 0.2s ease, height 0.4s ease;
transition: background-color 0.2s ease;
}

.reader-progress-slide {
Expand All @@ -2048,6 +2037,19 @@ $notesWidthPercent: 25%;
transition: background-color 0.2s ease;
}

// Hit area
.reader-progress-slide:after {
content: '';
position: absolute;
width: 200%;
height: 100%;
top: 0;
left: -50%;
background: rgba( 0, 0, 0, 0 );
z-index: -1;
}

.reader-progress-slide:hover,
.reader-progress-slide.active {
background-color: rgba(var(--r-overlay-element-bg-color), 0.4);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/reveal.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js.map

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions examples/reader-mode.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@
<div class="slides">

<section><h1>Reader Mode</h1></section>
<section data-background="indigo">
<h2>Scroll triggers</h2>
<ul>
<li class="fragment fade-left">Step one</li>
<li class="fragment fade-left">Step two</li>
<li class="fragment fade-left">Step three</li>
</ul>
</section>
<section data-background-color="#fff"><h2>Scroll bar inverts<br>based on slide bg</h2></section>
<section data-auto-animate data-auto-animate-easing="cubic-bezier(0.770, 0.000, 0.175, 1.000)">
<h2>Auto-Animate</h2>
<p>Automatically animate matching elements across slides with <a href="https://revealjs.com/auto-animate/">Auto-Animate</a>.</p>
Expand All @@ -46,14 +55,6 @@ <h2 style="margin-top: 20px;">Auto-Animate</h2>
</div>
<h2 style="margin-top: 20px;">Auto-Animate</h2>
</section>
<section data-background="indigo">
<h2>Scroll triggers</h2>
<ul>
<li class="fragment">Fragment one</li>
<li class="fragment">Fragment two</li>
<li class="fragment">Fragment three</li>
</ul>
</section>
<section data-background-gradient="linear-gradient(to bottom, #283b95, #17b2c3)" id="gradient-bg">
<h2>Gradient Backgrounds</h2>
</section>
Expand Down Expand Up @@ -98,7 +99,6 @@ <h2>Image Backgrounds</h2>
<h2>Video background</h2>
</section>
</section>
<section data-background-color="#fff"><h2>White background</h2></section>
<section><h2>The end</h2></section>

</div>
Expand Down
2 changes: 1 addition & 1 deletion js/controllers/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export default class Reader {

this.viewportElement.setAttribute( 'data-reader-scroll-bar', config.readerScrollbar )

if( config.readerScrollbar ) {
if( config.readerScrollbar && this.pages.length > 1 ) {
// Create the progress bar if it doesn't already exist
if( !this.progressBar ) this.createProgressBar();

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c4e322c

Please sign in to comment.