@@ -65,7 +65,8 @@ export class Carousel extends React.Component<ICarouselProps, ICarouselState> {
6565 loadingComponentContainerStyles,
6666 prevButtonIconName = 'ChevronLeft' ,
6767 nextButtonIconName = 'ChevronRight' ,
68- loadingComponent = < Spinner />
68+ loadingComponent = < Spinner /> ,
69+ pauseOnHover
6970 } = this . props ;
7071
7172 const processing = processingState === ProcessingState . processing ;
@@ -86,7 +87,12 @@ export class Carousel extends React.Component<ICarouselProps, ICarouselState> {
8687 onClick = { ( ) => { this . onCarouselButtonClicked ( false ) ; } } />
8788 </ div >
8889
89- < div className = { this . getMergedStyles ( styles . contentContainer , contentContainerStyles ) } >
90+ < div
91+ className = { this . getMergedStyles ( styles . contentContainer , contentContainerStyles ) }
92+ onMouseOver = { pauseOnHover ? this . pauseCycle : undefined }
93+ onTouchStart = { pauseOnHover ? this . pauseCycle : undefined }
94+ onMouseLeave = { pauseOnHover ? this . startCycle : undefined }
95+ onTouchEnd = { pauseOnHover ? this . startCycle : undefined } >
9096 {
9197 processing &&
9298 < div className = { this . getMergedStyles ( styles . loadingComponent , loadingComponentContainerStyles ) } >
@@ -463,4 +469,15 @@ export class Carousel extends React.Component<ICarouselProps, ICarouselState> {
463469 }
464470 }
465471 }
472+
473+ private pauseCycle = ( ) : void => {
474+ if ( this . _intervalId ) {
475+ if ( this . props . triggerPageEvent ) {
476+ clearTimeout ( this . _intervalId ) ;
477+ }
478+ else {
479+ clearInterval ( this . _intervalId ) ;
480+ }
481+ }
482+ }
466483}
0 commit comments