added isFirstSlide/isLastSlide api methods
This commit is contained in:
parent
24a59a53fd
commit
e1872c9115
41
js/reveal.js
41
js/reveal.js
|
@ -1529,25 +1529,7 @@ var Reveal = (function(){
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Boolean} true if current slide is first slide,
|
||||
* false otherwise
|
||||
*/
|
||||
|
||||
function firstSlide(){
|
||||
return (document.querySelector(SLIDES_SELECTOR + '.past') == null ? true : false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {Boolean} true if current slide is last slide,
|
||||
* false otherwise
|
||||
*/
|
||||
|
||||
function lastSlide(){
|
||||
return (document.querySelector(SLIDES_SELECTOR + '.future') == null ? true : false);
|
||||
}
|
||||
// --------------------------------------------------------------------//
|
||||
// ----------------------------- EVENTS -------------------------------//
|
||||
// --------------------------------------------------------------------//
|
||||
|
@ -1898,14 +1880,6 @@ var Reveal = (function(){
|
|||
return scale;
|
||||
},
|
||||
|
||||
isFirstSlide: function(){
|
||||
return firstSlide();
|
||||
},
|
||||
|
||||
isLastSlide: function(){
|
||||
return lastSlide();
|
||||
},
|
||||
|
||||
// Helper method, retrieves query string as a key/value hash
|
||||
getQueryHash: function() {
|
||||
var query = {};
|
||||
|
@ -1917,6 +1891,21 @@ var Reveal = (function(){
|
|||
return query;
|
||||
},
|
||||
|
||||
// Returns true if we're currently on the first slide
|
||||
isFirstSlide: function() {
|
||||
return document.querySelector( SLIDES_SELECTOR + '.past' ) == null ? true : false;
|
||||
},
|
||||
|
||||
// Returns true if we're currently on the last slide
|
||||
isLastSlide: function() {
|
||||
if( currentSlide && currentSlide.classList.contains( '.stack' ) ) {
|
||||
return currentSlide.querySelector( SLIDES_SELECTOR + '.future' ) == null ? true : false;
|
||||
}
|
||||
else {
|
||||
return document.querySelector( SLIDES_SELECTOR + '.future' ) == null ? true : false;
|
||||
}
|
||||
},
|
||||
|
||||
// Forward event binding to the reveal DOM element
|
||||
addEventListener: function( type, listener, useCapture ) {
|
||||
if( 'addEventListener' in window ) {
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue