diff options
-rw-r--r-- | demo.html | 7 | ||||
-rw-r--r-- | js/reveal.js | 14 |
2 files changed, 19 insertions, 2 deletions
@@ -232,6 +232,13 @@ <pre><code class="hljs html" style="word-wrap: break-word;"><section data-background-transition="zoom"></code></pre> </section> + <section data-background-iframe="https://hakim.se" data-background-interactive> + <div style="position: absolute; width: 40%; right: 0; box-shadow: 0 1px 4px rgba(0,0,0,0.5), 0 5px 25px rgba(0,0,0,0.2); background-color: rgba(0, 0, 0, 0.9); color: #fff; padding: 20px; font-size: 20px; text-align: left;"> + <h2>Iframe Backgrounds</h2> + <p>Since reveal.js runs on the web, you can easily embed other web content. Try interacting with the page in the background.</p> + </div> + </section> + <section> <h2>Pretty Code</h2> <pre><code class="hljs" data-trim data-line-numbers="4,8-9"> diff --git a/js/reveal.js b/js/reveal.js index 662679b..de12ed7 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -4237,7 +4237,7 @@ } - return pastCount / ( totalCount - 1 ); + return Math.min( pastCount / ( totalCount - 1 ), 1 ); } @@ -4330,11 +4330,21 @@ writeURLTimeout = setTimeout( writeURL, delay ); } else if( currentSlide ) { + // If we're configured to push to history OR the history + // API is not avaialble. if( config.history || !window.history ) { window.location.hash = locationHash(); } + // If we're configured to refelct the current slide in the + // URL without pushing to history. else if( config.hash ) { - window.history.replaceState(null, null, '#' + locationHash()); + window.history.replaceState( null, null, '#' + locationHash() ); + } + // If history and hash are both disabled, a hash may still + // be added to the URL by clicking on a href with a hash + // target. Counter this by always removing the hash. + else { + window.history.replaceState( null, null, window.location.pathname + window.location.search ); } } |