Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Adam Smallman
218 PointsjQuery forward and back image slider
Hello,
I am having some trouble making a simple jquery image slider with two buttons to go forward and back through the images. The button to go forward is working fine, users can click the forward button and move forward through the images.
But the back button is not working as I need it, it seems to just be going forward or even skipping one slide.
Here is the code for the back button
javascript
$("#slideshow > div:gt(-1)").hide();
$(".Leftarrow").click(function(){
$('#slideshow > div:first')
.fadeOut(1000)
.next()
.fadeIn(1000)
.end()
.appendTo('#slideshow');
});
changing .next() to .prev() makes the image disappear once the back button is hit. changing div:gt(0) to div:gt(-1) seems to skip a slide or two.
Anyone have and idea on how to fix this? I just need the slides to go backwards from what ever slide its currently one.
Thank you
Chyno Deluxe
16,936 PointsChyno Deluxe
16,936 Points//Fixed Code Presentation
How to post code