I'm looking for the best way to only play an image slideshow when a user hovers the mouse over the image (slideshow again stops when user moves the mouse outside the image).
The demo below does everything I need but the hover functionality.
Link to demo
Link to documentation
Here is the html
<div class="fadein">
<img src="http://farm3.static.flickr.com/2610/4148988872_990b6da667.jpg">
<img src="http://farm3.static.flickr.com/2597/4121218611_040cd7b3f2.jpg">
<img src="http://farm3.static.flickr.com/2531/4121218751_ac8bf49d5d.jpg">
</div>
and jQuery
$(function(){
$('.fadein img:gt(0)').hide();
setInterval(function(){
$('.fadein :first-child').fadeOut()
.next('img').fadeIn()
.end().appendTo('.fadein');},
3000);
});
Also I'm looking for the best way to increase the slideshow speed, decreased 3000 to 1000,(pointed out by RUJordan)
This is might be what you're looking for: https://github.com/sladex/images-rotation
Taken code from this link http://chandreshrana.blogspot.in/2016/01/image-slide-start-on-mouse-hover-jquery.html
Here is a Working demo
All you have to do is, call the function on hover and
clearInterval
on mouseOut.Jquery
I'm looking for the best way to only play an image slideshow when a user hovers the mouse over the image (slideshow again stops when user moves the mouse outside the image).
You mean "mouseenter"
Check this example:
http://jsfiddle.net/F4peh/1/