リンクがクリックされたときに開いているパネルを右にスライドさせるために、次の JavaScript を使用しています。
jQuery(関数($) {
$('a.panel').click(function() {
var $target = $($(this).attr('href')),
$other = $target.siblings('.active'),
animIn = function () {
$target.addClass('active').show().css({
left: -($target.width())
}).animate({
left: 0
}, 500);
};
if (!$target.hasClass('active') && $other.length > 0) {
$other.each(function(index, self) {
var $this = $(this);
$this.removeClass('active').animate({
left: -$this.width()
}, 500, animIn);
});
} else if (!$target.hasClass('active')) {
animIn();
}
});
});
また、すべてのパネルに閉じるボタンを追加したいと思います。クリックすると、パネルが閉じたり、左にスライドしたりします。
私はこのjsfiddleに取り組んでいます
アイデアはありますか?ありがとう。