In order to change the content when a button or number is clicked, you can utilize the buttons "1,2,3,4" or the Next and Prev buttons shown in the snippet. Both methods allow access to the same article. If you want to switch between articles using the Next/Prev buttons or the numbered buttons, simply refresh the page first.
$(document).ready(function() {
$(".btn-hover div").each(function(e) {
if (e != 0)
$(this).hide();
});
$("#next").click(function() {
if ($(".content5 div:visible,.content6 div:visible").next().length != 0)
$(".content5 div:visible,.content6 div:visible").next().show().prev().hide();
else {
$(".content5 div:visible,.content6 div:visible").hide();
$(".content5 div:first,.content6 div:first").show();
}
return false;
});
$("#previous").click(function() {
if ($(".content5 div:visible,.content6 div:visible").prev().length != 0)
$(".content5 div:visible,.content6 div:visible").prev().show().next().hide();
else {
$(".content5 div:visible,.content6 div:visible").hide();
$(".content5 div:last,.content6 div:last").show();
}
return false;
});
$('.btn-hover').first().addClass('btn-active');
$('.btn-hover').click(function(){
var $this = $(this);
$siblings = $this.parent().children(),
position = $siblings.index($this);
console.log (position);
$('.content5 div').removeClass('btn-active').eq(position).addClass('btn-active');
$('.content6 div').removeClass('btn-active').eq(position).addClass('btn-active');
$siblings.removeClass('btn-active');
$this.addClass('btn-active');
});
});
<!doctype html>
<html lang="en">
<head>
</head>
<body>
<!--Navbar-->
<div id="section1-the-timeline" class="scrollNav">
<div class="container-fluid section section_bg_grey">
<div class="col">
<div Class="button-wrap timeline px-5">
<a href="#section2-the-timeline" class="btn-hover">1</a>
<a href="#section2-the-timeline" class="btn-hover">2</a>
<a href="#section2-the-timeline" class="btn-hover">3</a>
</div>
</div>
</div>
</div>
<div id="section2-the-timeline" class="section section_secondary_bg">
<div class="container-fluid">
<div class="row d-flex align-items-center">
<div class="col-md-7">
<div class="text-center section_content">
<div id="content5" class="content5 pb-4">
<div class="btn-content-1 btn-active">
<p>1</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eveniet provident accusamus itaque suscipit adipisci</p>
</div>
<div class="btn-content-2">
<p>2</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eveniet provident accusamus itaque suscipit adipisci ullam reiciendis beatae perspiciatis impedit quam nemo asperiores, deserunt, distinctio</p>
</div>
<div class="btn-content-3">
<p>3</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eveniet provident accusamus itaque suscipit adipisci</p>
</div>
</div>
</div>
</div>
<div class="col-md-5 img_wrapper">
<div id="content6" class="content6">
<div class="btn-content-1 btn-active"><img src="https://en.wikipedia.org/wiki/Image#/media/File:Image_created_with_a_mobile_phone.png"></div>
<div class="btn-content-2"><img src="https://en.wikipedia.org/wiki/Image#/media/File:Image_created_with_a_mobile_phone.png"></div>
<div class="btn-content-3"><img src="https://en.wikipedia.org/wiki/Image#/media/File:Image_created_with_a_mobile_phone.png"></div>
</div>
</div>
</div>
</div>
</div>
<div class="chevron">
<div class="d-flex justify-content-center middle-chevron">
<button id="previous" class="btn btn-chevron"><i class="fas fa-chevron-left"></i></button>
<button id="next" class="btn btn-chevron"><i class="fas fa-chevron-right"></i></button>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="js/animation.js"></script>
</body>
</html>