Bummer! That Track couldn't be located. Perhaps one of the Tracks below is what you're looking for?

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

JavaScript

Javascript gallery

Hello treehouse, I have done a basic gallery, now i want to ask you guys, how can I make movements between image switches? no jquery. And another thing, how do you make a swipe in js? <button id="Forward">Forward</button> <button id="Backwards">Backwards</button> <div id="gallery"></div> <script> function Gallery(list) { this.list = list; document.getElementById("gallery").innerHTML = '<img src="'+this.list[0]+'">'; this.count = 0; var len = this.list.length; this.Forward = function() { var max = this.list.length; this.count++;
document.getElementById("gallery").innerHTML = '<img src="'+this.list[this.count]+'">'; } this.backwards = function() { if(this.count > 0) { this.count--; document.getElementById("gallery").innerHTML = '<img src="'+this.list[this.count]+'">'; }else { document.getElementById("gallery").innerHTML = '<img src="'+this.list[2]+'">'; } } } var list = ["p0","p1","p2","p3","p4"]; var gallery = new Gallery(list); document.getElementById("Forward").onclick = function(){gallery.Forward();} document.getElementById("backwards").onclick = function(){gallery.backwards();} </script>