У меня есть два или более события щелчка, поэтому я хочу открыть модальное окно Bootstrap. Моя проблема заключалась в том, что когда я открывал модальное окно с помощью jquery и внутри модального окна, я полагаю, что рассмотрел три раздела. В моем событии щелчка также есть три таких же, как и в модальном. В случае, когда я собираюсь щелкнуть, теперь модальное окно bootstrap запущено (открыто), но оно не может получить значение смещения конкретного раздела, а также не прокручивается внутри модального окна. Мое единственное намерение основано на необходимости щелкнуть мышью, чтобы прокрутить модальное окно bootstrap и показать конкретный раздел.
Здесь я прикрепил свой код Bootstrap модальный
<div class="modal fade modal5 in" id="myModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Testing</h4>
</div>
<div class="modal5-body">
<div class="terms_condition section-1" data-section="section-1" id="section-1">
<h3>Section One</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
</div>
<div class="terms_condition section-2" data-section="section-2" id="section-2">
<h3>Section Two</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
</div>
<div class="terms_condition section-3" data-section="section-3" id="section-3">
<h3>Section Three</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
</div> </div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
для события My Click Html Code
<a href="#" data-toggle="modal" data-target="#myModal5" data-section="section-1"> T & C</a>
<a href="#" data-toggle="modal" data-target="#myModal5" data-section="section-2"> T & C</a>
<a href="#" data-toggle="modal" data-target="#myModal5" data-section="section-3"> T & C</a>
My Jquery должно быть так
$(document).on('show.bs.modal', '#myModal5', function(event) {
var section = $(event.relatedTarget).data('section');
var sectionOffset = $('#' + section).offset();
$('#myModal5 .modal5-body').animate({
scrollTop: sectionOffset.top
}, 1000);
});