Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am run this program but not perform... Only Last image is display and not change the images...

XML
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css"  href="next-prev.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
    var imgFirst = $('#img-grp-wrap .img-wrap img:first-child');
$('#img-grp-wrap .img-wrap img:gt(0)').hide();

function slideShow() {
     imgFirst.fadeOut().next('img').fadeIn().end().appendTo('.img-wrap');
}

var rotate = setInterval(function() {
    slideShow();
}, 4000);

$('#img-grp-wrap .prev, #img-grp-wrap .next').hover(function() {
    clearInterval(rotate);
}, function() {
    var rotate = setInterval(function() {
        slideShow();
    }, 4000);
});

$('#img-grp-wrap .next').click(function() {
    imgFirst.stop().fadeOut().next().fadeIn().end().appendTo('.img-wrap');
});

$('#img-grp-wrap .prev').click(function() {
    imgFirst.stop().fadeOut();
    $('#img-grp-wrap .img-wrap img:last-child').prependTo('.img-wrap').fadeOut();
    imgFirst.fadeIn();
});

</script>
</head>
<body>
<div id="img-grp-wrap">
    <div class="img-wrap">
        <img src="1.jpg" />
        <img src="2.jpg" />
        <img src="3.jpg" />

    </div>

    <img src="arrowright.jpg" class="next" alt="Next"/>
    <img src="arrowleft.jpg" class="prev" alt="Previous"/>

</div>

</body>
</html>


So plz help or some suggestion
Posted
v2
Comments
Peter Leow 20-Dec-13 10:14am    
Could you explain more on what is working and what not? hover? next click? etc...

1 solution

I have corrected your code and made it simple.

Check the demo- [Demo] Image Rotator Example[^].

You will find Code Project Images rotating. :) :) :P
 
Share this answer
 
Comments
moin raza khan 20-Dec-13 22:46pm    
Thanks bro..
Most welcome buddy. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900