Код: Выделить всё
Car ride home! First time meeting each other.
[img]images/Finley/car_ride_home.jpg[/img]
[img]images/Finley/car_ride_home.jpg[/img]
[img]images/Finley/he_lay.jpg[/img]
[img]images/Finley/awwww.jpg[/img]
[img]images/Finley/photogenic_af.jpg[/img]
[img]images/Finley/first_vet.jpg[/img]
[img]images/Finley/blop.jpg[/img]
[img]images/Finley/squishy_cheek.jpg[/img]
[img]images/Finley/first_beach.jpg[/img]
[img]images/Finley/sploot.jpg[/img]
[img]images/Finley/floopy_ears.jpg[/img]
[img]images/Finley/daisy_gf.jpg[/img]
Код: Выделить всё
$(document).ready(function() {
//declare variables
var nextSlide = $("#slides img:first-child");
var nextCaption;
var nextSlideSource;
// the function for running the slide show
var runSlideShow = function() {
// write the function
$("#caption").fadeOut(1000);
$("#slide").fadeOut(1000,
function() { //callback function
if (nextSlide.next().length == 0) {
nextSlide = $("#slides img:first-child");
} else {
nextSlide = nextSlide.next();
}
nextSlideSource = nextSlide.attr("src");
nextCaption = nextSlide.attr("alt");
if (nextCaption == "Papa, we made it to the community Instagram!") {
$("#caption").attr("href", nextSlide.attr("href"); $("#caption").attr("target", nextSlide.attr("target");
}
$("#slide").attr("src", nextSlideSource).fadeIn(1000); $("#caption").text(nextCaption).fadeIn(1000);
}
); //callback
}; //ready
// start slide show
var timer1 = setInterval(runSlideShow, 5000);
// here's one way to code this app without using the toggle event method
$("#slide").click(function() {
if (timer1 != null) {
clearInterval(timer1);
timer1 = null;
} else {
timer1 = setInterval(runSlideShow, 1000);
}
});
})
Подробнее здесь: https://stackoverflow.com/questions/592 ... -attribute
Мобильная версия