JSFiddle - React, Tailwind, and code Playground

by Lakshman Kambam

HTML

<a href="#clickhere" data-toggle="modal" data-id="Scroll1" class="btn btn-primary">Section-1</a>
<a href="#clickhere" data-toggle="modal" data-id="Scroll2" class="btn btn-success">Section-2</a>
<a href="#clickhere" data-toggle="modal" data-id="Scroll3" class="btn btn-warning">Section-3</a>

<div class="modal fade" id="clickhere">
    <div class="modal-dialog">
        <div class="modal-content">
			<div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Modal title</h4>
            </div>
			<div class="modal-body">
				<div class="sectionscroll second" data-id="Scroll1">
					<h3>Scroll One</h3>
					<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
				</div>
				<div class="sectionscroll" data-id="Scroll2">
					<h3>Scroll Two</h3>
					<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem...

JavaScript

$(document).ready(function () {
    $('#clickhere').on('shown.bs.modal', function (e) {
        var id = $(e.relatedTarget).data('id');
        var team = $('.sectionscroll[data-id="' + id + '"]');
        $(this).animate({
            scrollTop: team.offset().top
        }, 1000);
    });
});