jQuery로 빌드 된 슬라이드 쇼를 가져 오면 일시 중지됩니다. 클릭 한 이미지를 진행하는 미리보기 그룹이 이미지 위에 표시됩니다. 그렇지 않으면 슬라이드 쇼가 모든 이미지를 자동으로 회전합니다. 각 이미지와 관련된 캡션을 확장하고 계약하는 +/-도 있습니다. 미리보기 이미지 중 하나가 클릭되거나 +/-가 표시되면 슬라이드 쇼의 자동 진행을 중지하고 싶습니다. 기본적으로 사용자가 갤러리 내 아무 곳이나 클릭 할 때마다 중지하십시오 (div class = ". homeImg"). 나는 이것이 올바르게 작동하도록하는 데있어 큰 두뇌 방귀를 가지고 있고 조언을 사용할 수 있습니다. 여기에 jQuery를이다 : 당신의 마지막 줄에클릭시 jQuery 슬라이드 쇼 애니메이션 가져 오기
$(document).ready(function() {
$(".main_image .desc").show(); //Show image info
$(".main_image .block").animate({ opacity: 0.85 }, 1); //Set Opacity
//Click and Hover events for thumbnail list
$(".image_thumb ul li:first").addClass('active');
// * Adds a class 'last' to the last li to let the rotator know when to return to the first
$(".image_thumb ul li:last").addClass('last');
$(".image_thumb ul li").click(function(){
//Set Variables
var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
var imgDesc = $(this).find('.block').html(); //Get HTML of block
var imgDescHeight = $(".main_image").find('.block').height(); //Calculate height of block
if ($(this).is(".active")) { //If it's already active, then…
return false; // Don't click through
} else {
//Animate
$(".main_image img").animate({ opacity: 0}, 800);
$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 800, function() {
$(".main_image .block").html(imgDesc).animate({ opacity: 0.85, marginBottom: "0" }, 250);
$(".main_image img").attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250);
});
}
$(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
$(this).addClass('active'); //add class of 'active' on this list only
return false;
}) .hover(function(){
$(this).addClass('hover');
}, function() {
$(this).removeClass('hover');
});
//Toggle teaser
$("a.collapse").click(function(){
$(".main_image .block").slideToggle();
$("a.collapse").toggleClass("show");
return false; // added to remove # browser jump
});
// If we are hovering over the image area, pause the clickNext function
pauseClickNext = false;
$(".homeImg").hover(
function() {
pauseClickNext = true;
},
function() {
pauseClickNext = false;
}
);
// Define function to click the next li
var clickNext = function(){
if(!pauseClickNext) {
/// find the next li after .active
var $next_li = $("li.active").next("li");
if($("li.active").hasClass("last")){
$(".image_thumb ul li:first").trigger("click");
} else {
$next_li.trigger("click");
}
}
};
// Time between image transition
setInterval(clickNext, 6000);
});
애니메이션의 첫 번째 커플 후에 어떤 코드가 계속 순환하는지 알 수 없습니다. 타이머를 사용하고 있지 않습니까? – arnorhs