好的,所以我仍然想要了解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');
});
答案 0 :(得分:1)
不确定这是否是您要实现的目标但是..添加stopPropagation?
$('h1.close').click(function (e) {
e.stopPropagation();
// The rest is the same :)
答案 1 :(得分:0)
如果使用$('#div-to-hide').hide()