noushad mohammed
noushad mohammed

Reputation: 375

how to start slide on mouehover, and set first image when mouse out in cycle 2 slider plugin

I have a running code that works only when I mouse hover on it and it stops when I take the mouse out of it. but my requirement is when I make a mouse out the images should set to default i.e first image should be set.

<div class="cycle-slideshow">
  <img src="http://malsup.github.io/images/p1.jpg" class="cycle-carousel-wrap">
  <img src="http://malsup.github.io/images/p2.jpg" class="cycle-carousel-wrap">
  <img src="http://malsup.github.io/images/p3.jpg" class="cycle-carousel-wrap">
  <img src="http://malsup.github.io/images/p4.jpg" class="cycle-carousel-wrap">
</div>
<script>
  $(document).ready(function() {
    function buildCycle() {
      $('.cycle-slideshow').cycle({
        timeout: 500,
        delay: 1,
        speed: 1
      })
    }
    $('.cycle-slideshow').cycle("pause").hover(function() {
      $(this).cycle('resume');
    }, function() {
      $(this).cycle('pause');
    });
  });
</script>

How can I make it work?

Upvotes: 1

Views: 61

Answers (0)

Related Questions