slides three or more steps away from current are now hidden
This commit is contained in:
parent
01000e1478
commit
f6dc531298
23
js/reveal.js
23
js/reveal.js
@ -283,15 +283,22 @@ var Reveal = (function(){
|
|||||||
|
|
||||||
slides[index].setAttribute('class', 'present');
|
slides[index].setAttribute('class', 'present');
|
||||||
|
|
||||||
// Any element previous to index is given the 'past' class
|
for( var i = 0; i < slides.length; i++ ) {
|
||||||
slides.slice(0, index).map(function(element){
|
var slide = slides[i];
|
||||||
element.setAttribute('class', 'past');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Any element subsequent to index is given the 'future' class
|
// Optimization; hide all slides that are three or more steps
|
||||||
slides.slice(index + 1).map(function(element){
|
// away from the present slide
|
||||||
element.setAttribute('class', 'future');
|
slide.style.display = Math.abs( index - i ) > 3 ? 'none' : 'block';
|
||||||
});
|
|
||||||
|
if( i < index ) {
|
||||||
|
// Any element previous to index is given the 'past' class
|
||||||
|
slide.setAttribute('class', 'past');
|
||||||
|
}
|
||||||
|
else if( i > index ) {
|
||||||
|
// Any element subsequent to index is given the 'future' class
|
||||||
|
slide.setAttribute('class', 'future');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Since there are no slides we can't be anywhere beyond the
|
// Since there are no slides we can't be anywhere beyond the
|
||||||
|
Loading…
Reference in New Issue
Block a user