|
@@ -80,65 +80,54 @@
|
|
$(this).attr('src'));
|
|
$(this).attr('src'));
|
|
});
|
|
});
|
|
|
|
|
|
- // the counter variable that keeps
|
|
|
|
- // track of which image you are showing
|
|
|
|
|
|
+ // The counter variable that keeps track of which image you are showing.
|
|
var counter = 1;
|
|
var counter = 1;
|
|
|
|
|
|
- // virtually click on the current
|
|
|
|
- // image to load it into the big image
|
|
|
|
|
|
+ // Virtually click on the current image to load it into the big image.
|
|
$("#image" + counter).click();
|
|
$("#image" + counter).click();
|
|
|
|
|
|
- // when you click on the backwards
|
|
|
|
- // button select the previous image
|
|
|
|
|
|
+ // When you click on the backwards button select the previous image
|
|
$("#backward").click(function () {
|
|
$("#backward").click(function () {
|
|
- // go back one in the counter
|
|
|
|
- counter = counter - 1;
|
|
|
|
- // if we are below 1 (the first
|
|
|
|
- // image) loop round to 4 (the
|
|
|
|
- // last image)
|
|
|
|
|
|
+ // Go back one in the counter.
|
|
|
|
+ counter--;
|
|
|
|
+
|
|
|
|
+ // If we are below 1 (the first image) loop round to 4 (the last image).
|
|
if (counter < 1) {
|
|
if (counter < 1) {
|
|
counter = 4;
|
|
counter = 4;
|
|
}
|
|
}
|
|
- // virtually click on the current
|
|
|
|
- // image to load it into the big image
|
|
|
|
|
|
+
|
|
|
|
+ // Virtually click on the current image to load it into the big image.
|
|
$("#image" + counter).click();
|
|
$("#image" + counter).click();
|
|
});
|
|
});
|
|
|
|
|
|
- // when you click on the backwards
|
|
|
|
- // button select the next image
|
|
|
|
|
|
+ // When you click on the backwards button select the next image.
|
|
$("#forward").click(function () {
|
|
$("#forward").click(function () {
|
|
- // go forward one in the counter
|
|
|
|
- counter = counter + 1;
|
|
|
|
- // if we are above 4 (the last
|
|
|
|
- // image) loop round to 1 (the
|
|
|
|
- // first image)
|
|
|
|
|
|
+ // Go forward one in the counter.
|
|
|
|
+ counter++;
|
|
|
|
+
|
|
|
|
+ // If we are above 4 (the last image) loop round to 1 (the first image).
|
|
if (counter > 4) {
|
|
if (counter > 4) {
|
|
counter = 1;
|
|
counter = 1;
|
|
}
|
|
}
|
|
- // virtually click on the current
|
|
|
|
- // image to load it into the big image
|
|
|
|
|
|
+
|
|
|
|
+ // Virtually click on the current image to load it into the big image.
|
|
$("#image" + counter).click();
|
|
$("#image" + counter).click();
|
|
});
|
|
});
|
|
|
|
|
|
- // when you click the big image
|
|
|
|
- // toggle pausing. Set paused to
|
|
|
|
- // not paused, i.e. if it is paused
|
|
|
|
- // set it to not paused, if it is
|
|
|
|
- // not paused set it to paused
|
|
|
|
|
|
+ // When you click the big image toggle pausing. Set paused to not paused,
|
|
|
|
+ // i.e. if it is paused set it to not paused, if it is not paused set it
|
|
|
|
+ // to paused.
|
|
$("#bigImage").click(function () {
|
|
$("#bigImage").click(function () {
|
|
paused = !paused;
|
|
paused = !paused;
|
|
});
|
|
});
|
|
|
|
|
|
- // set interval makes it move
|
|
|
|
- // forward every 3 second
|
|
|
|
|
|
+ // Set interval makes it move forward every 3 second.
|
|
setInterval(function () {
|
|
setInterval(function () {
|
|
- // first check if it is paused
|
|
|
|
|
|
+ // First check if it is paused.
|
|
if (!paused) {
|
|
if (!paused) {
|
|
- // virtual click the forward
|
|
|
|
- // button
|
|
|
|
|
|
+ // Virtual click the forward button.
|
|
$("#forward").click();
|
|
$("#forward").click();
|
|
}
|
|
}
|
|
- ;
|
|
|
|
}, 3000);
|
|
}, 3000);
|
|
</script>
|
|
</script>
|
|
</body>
|
|
</body>
|