두 이벤트가 있습니다 첫 번째로 이동하고 확장하는 이미지를 클릭하십시오 두 번째로 이미지 바깥 쪽을 클릭하면 해당 이미지가 이동하고 다시 축소됩니다. 위치. 당신은 그것은 이것 때문에 아주 오래 복용이상한 jquery 애니메이션 동작
$(document).ready(function() {
var titles=new Array("1","2","3", "4","5", "6", "7", "8","9");
var image=0;
var p;
$('.grid li').click(function() {
var location =$(this).index();
image = $(this).position();
$(this).siblings().animate({opacity: 1, top:'15px'},800,function() {
$(this).siblings().css("top", "0px");
p =$(this).parent().detach();
$('.pop_image img ').css("left", image.left);
$('.pop_image img').css("top", image.top);
$('.pop_title ').css("left", image.left);
$('.pop_title').css("top", image.top-50);
$('.pop_image img').animate({marginLeft: '20%',marginRight: '20%', marginTop: '20%', top: '0', left: '0'},800);
$('.pop_image img').attr("src", location+1 +".jpg");
$('.pop_title').animate({marginLeft: '20%',marginRight: '20%', marginTop: '20%', top: '-50px', left: '0'},800);
$('.pop_title ').text(titles[location]);
$('.pop_title').animate({fontSize: '200%'},800);
$('.pop_image img').animate({width:'679px', height:'422px'},800);
});
});
$('#hidden').click(function() {
$('.pop_title').animate({fontSize: '100%'},800);
$('.pop_image img').animate({width:'339px', height:'211px'},800);
$('.pop_image img').animate({left: image.left, right: image.top },800);
$('.pop_title').animate({left: image.left, right: image.top },800);
});
});
테스트를 위해 jsFiddle 또는 유사한 것을 만들 수 있습니까? –
님이 jsfiddle을 추가했습니다. –
Woz가 +1 했습니까? :) – YD1m