Good day.
Task: to make an accordion with functionality, as on this site - https://smylhub.com/ . Why when clicking on the <a> scroll occurs in the wrong place (it is always different)? Tried to use plugins - the result is the same.
HTML:
<pre> <ul class="accordeon_list"> <li class="accordeon_item active" id="ac_itm_1"> <a href="#" class="accordeon_trigger" id="ac_btn_1">click1</a> <span class="accordeon_inner">content</span> </li> <li class="accordeon_item" id="ac_itm_2"> <a href="#" class="accordeon_trigger" id="ac_btn_2">click2</a> <span class="accordeon_inner">content</span> </li> <li class="accordeon_item" id="ac_itm_3"> <a href="#" class="accordeon_trigger" id="ac_btn_3">click2</a> <span class="accordeon_inner">content</span> </li> </ul> </pre> Js:
$(".accordeon_trigger").click(function (){ $('html, body').animate({ scrollTop: $(this).closest(".accordeon_item").offset().top }, 2000); });