At the center of my webpage, I have a small menu. When you click on a button, it should smoothly scroll horizontally to the chosen content. However, when clicking, the entire window scrolls, making the menu disappear from view. The issue is illustrated here:
Below is the code segment that needs modification and implementation:
<div id="left">
<a href="#target1" class="panel">Target 1</a><br/>
<a href="#target2" class="panel">Target 2</a><br/>
<a href="#target3" class="panel">Target 3</a><br/>
<div id="right">
<div class="panel" id="target1" style="background:green">Target 1</div>
<div class="panel" id="target2" style="background:red">Target 2</div>
<div class="panel" id="target3" style="background:yellow">Target 3</div>
Incorporate some jQuery script to enable smooth sliding from #left to #right.
View the functioning demo here: