您必须将left:100%从#content section:nth-child(1)替换为left:0%并添加此 css
#content .active{
z-index: 100;
}
把js改成这个
$("#content section").css("visibility", "hidden")
.each(function(index, element) {
elem=$(element);
if (!(elem.hasClass("active"))) {
elem.fadeOut();
}
});
$("#content .active").css("visibility", "visible").fadeIn();
$('a').on('click', function (event) {
//event.preventDefault();
var sectionId = $(this).attr("data-section"),
$toSlide = $("#content section#" + sectionId),
$fromSlide = $('.active');
if (!($toSlide.hasClass("active"))) {
$fromSlide.fadeOut().css("visibility", "hidden").removeClass("active");
$toSlide.addClass("active").css("visibility", "visible").fadeIn();
}
});