【发布时间】:2013-04-10 13:34:44
【问题描述】:
好的,所以我仍在尝试掌握 jQuery。
我已经差不多了!我需要关闭按钮开始关闭,但因为它在同一个容器中,它也会启动其他动画。有什么建议吗?
到目前为止,这是我的代码的 jsfiddle 链接http://jsfiddle.net/w39Bb/5/
$('.outer-shell').click( function () {
$(this).animate({
height: '580px'
}, 750).addClass('selected');
$(this).find('.inner-shell').animate({
height: '550px'
}, 750);
$(this).find('.details-click').animate({
width: "0"
}, 400).hide(100);
$(this).find('.image-left-small , .image-right-small').animate({
opacity: 0
}).hide(400);
$(this).find('.image-left-large, .image-right-large').animate({
opacity: 1
}).show(0);
$(this).find('.close').animate({
opacity: 1
}, 1000).show();
});
$('h1.close').click(function () {
$('.outer-shell').animate({
height: '235px'
}, 200).removeClass('selected');
$('.inner-shell').animate({
height: '229px'
}, 200);
$('.details-click').animate({
width: '299px'
}, 100).show();
$('.image-left-small , .image-right-small').animate({
opacity: 1
}, 100).show();
$('.image-left-large, .image-right-large').animate({
opacity: 0
}, 400).hide();
});
$('.outer-shell').hover( function () {
$(this).toggleClass('hover');
});
【问题讨论】:
-
您需要使用外壳上的“id”来编写脚本,然后定位您所指的外壳。