【发布时间】:2012-11-19 21:07:28
【问题描述】:
$('.transparent-close').click(function(){ ...}); 内部调用的事件似乎没有工作。可能是因为它在另一个 .click() 事件中?
$('#featured-top').click(function(){
$(this).animate({'top':'-318px'}, 600, 'easeOutBounce');
$('#featured-top-container').animate({'margin':'260px 0 0 117px'}, 600, 'easeOutBounce');
$('#wrap').animate({'margin-top':'365px'}, 600, 'easeOutBounce');
//Add transparent background for click out
$(document.body).append('<div class="transparent-close"></div>');
$('.transparent-close').click(function(){
$('#featured-top').animate({'top':'-318px'}, 600, 'easeOutBounce');
$('#featured-top-container').animate({'margin':'260px 0 0 117px'}, 600, 'easeOutBounce');
$('#wrap').animate({'margin-top':'365px'}, 600, 'easeOutBounce');
$(this).remove();
});
});
【问题讨论】:
-
您是否通过调试器运行过它?
-
是的。没有错误,但它不会触发 $('.transparent-close').click(function(){ ...}); 中的事件;
标签: jquery click jquery-animate