stopOnHover not working correctly?
See original GitHub issueBeen troubleshooting the use of stopOnHover within my solution. First time I’ve decided to setup the use of autoPlay within the Carousel. Upon setting autoPlay, when I hover over the component, the autoPlay is not being stopped. stopOnHover by default is set to true and I also manually added the property to the component.
After some digging, the carouselWrapper value is undefined below so the addEventListeners are not being properly added within the setupAutoPlay.
key: 'setupAutoPlay',
value: function setupAutoPlay() {
this.autoPlay();
var carouselWrapper = this.refs['carouselWrapper'];
if (this.props.stopOnHover && carouselWrapper) {
carouselWrapper.addEventListener('mouseenter', this.stopOnHover);
carouselWrapper.addEventListener('mouseleave', this.startOnLeave);
}
}
Not quite sure why this is happening, even setting everything back to 100% default without my customizations to the CSS is still not working.
Any thoughts or something silly I’m completely forgetting…?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Owl carousel autoplay and stopOnHover not working
I would like to slow down the speed of slides and make them stop sliding on hover. I added a script to bottom...
Read more >Untitled
Fixed a bug where layer positions in slide editor where not correctly calculated if the layer had a padding or margin. white-space and...
Read more >Owl carousel 'trigger' question (Example) - Treehouse
I think I have to work with the 'this' selector but am not sure on how to ... loop: true, autoPlay : false,...
Read more >react-responsive-carousel - npm
Start using react-responsive-carousel in your project by running `npm i ... stopOnHover, boolean, The slide will not change by autoPlay on ...
Read more >Untitled
Fixed HTML Export gradiants not working properly; Fixed YouTube and Vimeo Video Rewind issue on reenter specific slides. Fixed Toggle FullScreen Mode where ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
And… switching from using the state object to passing in as a prop resolves this issue. I can get away with using this scenario for what I need. However, if anyone in the future needed to use the state to follow this same pattern, this issue may pop back up again.
Updating from this.state.newsBannerItems to this.props.newsBannerItems resolves this.
Works:
I’m experiencing same problem here. My work around still uses
this.state.newsBannerItems
. but put an empty<div>
as placeholder if its length is 0.