marain
09-22-2020, 10:09 PM
Folks,
Same page, https://www.njgunlawyers.com/page.php?here=FID , but with a different perplexing problem: The sizing issue appears to be completely solved (thanks to Coothead). The perplexing problem is that the slides present randomly, rather than sequentially. JS code:
"use strict";
$(document).ready(function() {
var nextSlide = $("#slides img:first-child");
var nextCaption;
var nextSlideSource;
// the function for running the slide show
var runSlideShow = function() {
$("#caption").fadeOut(2000);
$("#slide").fadeOut(2000,
function () {
if (nextSlide.next().length == 0) {
nextSlide = $("#slides img:first-child");
}
else {
nextSlide = nextSlide.next();
}
nextSlideSource = nextSlide.attr("src");
nextCaption = nextSlide.attr("alt");
$("#slide").attr("src", nextSlideSource).fadeIn(4500);
$("#caption").text(nextCaption).fadeIn(4500);
}
)
}
// start slide show
var timer1 = setInterval(runSlideShow, 4000);
// start and stop the slide show
$("#slide").click(function() {
if (timer1 != null) {
clearInterval(timer1);
timer1 = null;
}
else {
timer1 = setInterval(runSlideShow, 2000);
}
});
})
Is there a simple fix?
A.
Same page, https://www.njgunlawyers.com/page.php?here=FID , but with a different perplexing problem: The sizing issue appears to be completely solved (thanks to Coothead). The perplexing problem is that the slides present randomly, rather than sequentially. JS code:
"use strict";
$(document).ready(function() {
var nextSlide = $("#slides img:first-child");
var nextCaption;
var nextSlideSource;
// the function for running the slide show
var runSlideShow = function() {
$("#caption").fadeOut(2000);
$("#slide").fadeOut(2000,
function () {
if (nextSlide.next().length == 0) {
nextSlide = $("#slides img:first-child");
}
else {
nextSlide = nextSlide.next();
}
nextSlideSource = nextSlide.attr("src");
nextCaption = nextSlide.attr("alt");
$("#slide").attr("src", nextSlideSource).fadeIn(4500);
$("#caption").text(nextCaption).fadeIn(4500);
}
)
}
// start slide show
var timer1 = setInterval(runSlideShow, 4000);
// start and stop the slide show
$("#slide").click(function() {
if (timer1 != null) {
clearInterval(timer1);
timer1 = null;
}
else {
timer1 = setInterval(runSlideShow, 2000);
}
});
})
Is there a simple fix?
A.