fix issue where auto-animate did not work when jumping three or more slides (i.e. longer than the view distance)
							parent
							
								
									286d5ef561
								
							
						
					
					
						commit
						eada286ca0
					
				
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -176,6 +176,37 @@ | |||
| 					<h3>B2</h3> | ||||
| 				</section> | ||||
| 
 | ||||
| 				<section> | ||||
| 					<section id="stacked-slide-1" data-auto-animate> | ||||
| 						<a href="#/stacked-slide-1">Slide 1</a><br> | ||||
| 						<a href="#/stacked-slide-2">Slide 2</a><br> | ||||
| 						<a href="#/stacked-slide-3">Slide 3</a><br> | ||||
| 						<a href="#/stacked-slide-4">Slide 4</a><br> | ||||
| 						<div data-id="anim" style="background: indigo; padding: 8px; width: 50px; height: 50px; position: absolute; left: 0px;">A</div> | ||||
| 					</section> | ||||
| 					<section id="stacked-slide-2" data-auto-animate> | ||||
| 						<a href="#/stacked-slide-1">Slide 1</a><br> | ||||
| 						<a href="#/stacked-slide-2">Slide 2</a><br> | ||||
| 						<a href="#/stacked-slide-3">Slide 3</a><br> | ||||
| 						<a href="#/stacked-slide-4">Slide 4</a><br> | ||||
| 						<div data-id="anim" style="background: indigo; padding: 8px; width: 50px; height: 50px; position: absolute; left: 25%;">A</div> | ||||
| 					</section> | ||||
| 					<section id="stacked-slide-3" data-auto-animate> | ||||
| 						<a href="#/stacked-slide-1">Slide 1</a><br> | ||||
| 						<a href="#/stacked-slide-2">Slide 2</a><br> | ||||
| 						<a href="#/stacked-slide-3">Slide 3</a><br> | ||||
| 						<a href="#/stacked-slide-4">Slide 4</a><br> | ||||
| 						<div data-id="anim" style="background: indigo; padding: 8px; width: 50px; height: 50px; position: absolute; left: 50%;">A</div> | ||||
| 					</section> | ||||
| 					<section id="stacked-slide-4" data-auto-animate> | ||||
| 						<a href="#/stacked-slide-1">Slide 1</a><br> | ||||
| 						<a href="#/stacked-slide-2">Slide 2</a><br> | ||||
| 						<a href="#/stacked-slide-3">Slide 3</a><br> | ||||
| 						<a href="#/stacked-slide-4">Slide 4</a><br> | ||||
| 						<div data-id="anim" style="background: indigo; padding: 8px; width: 50px; height: 50px; position: absolute; left: 75%;">A</div> | ||||
| 					</section> | ||||
| 				</section> | ||||
| 
 | ||||
| 			</div> | ||||
| 
 | ||||
| 		</div> | ||||
|  |  | |||
|  | @ -50,11 +50,19 @@ export default class AutoAnimate { | |||
| 			// Flag the navigation direction, needed for fragment buildup
 | ||||
| 			animationOptions.slideDirection = toSlideIndex > fromSlideIndex ? 'forward' : 'backward'; | ||||
| 
 | ||||
| 			// If the from-slide is hidden because it has moved outside
 | ||||
| 			// the view distance, we need to temporarily show it while
 | ||||
| 			// measuring
 | ||||
| 			let fromSlideIsHidden = fromSlide.style.display === 'none'; | ||||
| 			if( fromSlideIsHidden ) fromSlide.style.display = this.Reveal.getConfig().display; | ||||
| 
 | ||||
| 			// Inject our auto-animate styles for this transition
 | ||||
| 			let css = this.getAutoAnimatableElements( fromSlide, toSlide ).map( elements => { | ||||
| 				return this.autoAnimateElements( elements.from, elements.to, elements.options || {}, animationOptions, autoAnimateCounter++ ); | ||||
| 			} ); | ||||
| 
 | ||||
| 			if( fromSlideIsHidden ) fromSlide.style.display = 'none'; | ||||
| 
 | ||||
| 			// Animate unmatched elements, if enabled
 | ||||
| 			if( toSlide.dataset.autoAnimateUnmatched !== 'false' && this.Reveal.getConfig().autoAnimateUnmatched === true ) { | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 hakimel
						hakimel