当我单击一张幻灯片时,我想让 jQuery 检查另一张幻灯片是否打开并关闭它。我已经编写了 90% 的代码,但是缺少一些东西。请参阅下面的 HTML:
这是我的 挑战!
//first slide
$('#one').toggle(function(){
$('.content').animate({width:'42%'});
}, function(){
$('.content').animate({width:'0%'});
});
//second slide
$('#two').toggle(function(){
$('.content1').animate({width:'42%'});
}, function(){
$('.content1').animate({width:'0%'});
});
//the condition ,here is the chalenge
$(function(){
$('#two').click(function(){
var two = $('.content').innerWidth();
//when the users click the second slide i want that jquery checks if another panel is open(in my case .content) and close it :D
});
});