我有两个事件正在进行第一次您单击它移动并展开的图像第二次您单击图像外部并且它移动并收缩回它的组织。位置。
出于某种原因,当您单击外部区域时,您必须等待 30 秒才能触发动画(收缩)
$(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);
});
});