aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2018-11-16 10:39:43 +0100
committerHakim El Hattab <hakim.elhattab@gmail.com>2018-11-16 10:39:43 +0100
commit8ac3383bee936aaf4939bf8d4cb30d5998ceff2b (patch)
treec64c216c513168bb66c758e16717516a75086f4c
parentf042a8c394718ebb7756aceb58f35d6204559779 (diff)
downloadfreenode-live-2017-presentation-8ac3383bee936aaf4939bf8d4cb30d5998ceff2b.tar
freenode-live-2017-presentation-8ac3383bee936aaf4939bf8d4cb30d5998ceff2b.tar.gz
add getRevealElement API method
-rw-r--r--README.md3
-rw-r--r--js/reveal.js9
2 files changed, 10 insertions, 2 deletions
diff --git a/README.md b/README.md
index c60e6a4..d8960b1 100644
--- a/README.md
+++ b/README.md
@@ -592,6 +592,9 @@ Reveal.isLastSlide();
Reveal.isOverview();
Reveal.isPaused();
Reveal.isAutoSliding();
+
+// Returns the top-level DOM element
+getRevealElement(); // <div class="reveal">...</div>
```
### Custom Key Bindings
diff --git a/js/reveal.js b/js/reveal.js
index f6f7903..637ea63 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -5683,6 +5683,11 @@
return query;
},
+ // Returns the top-level DOM element
+ getRevealElement: function() {
+ return dom.wrapper || document.querySelector( '.reveal' );
+ },
+
// Returns true if we're currently on the first slide
isFirstSlide: function() {
return ( indexh === 0 && indexv === 0 );
@@ -5724,12 +5729,12 @@
// Forward event binding to the reveal DOM element
addEventListener: function( type, listener, useCapture ) {
if( 'addEventListener' in window ) {
- ( dom.wrapper || document.querySelector( '.reveal' ) ).addEventListener( type, listener, useCapture );
+ Reveal.getRevealElement().addEventListener( type, listener, useCapture );
}
},
removeEventListener: function( type, listener, useCapture ) {
if( 'addEventListener' in window ) {
- ( dom.wrapper || document.querySelector( '.reveal' ) ).removeEventListener( type, listener, useCapture );
+ Reveal.getRevealElement().removeEventListener( type, listener, useCapture );
}
},