A
A
Artem Pavliienko2018-02-08 11:41:31
JavaScript
Artem Pavliienko, 2018-02-08 11:41:31

How to move with accordion title?

Hello.
I made an accordion, when I open the first tab everything is OK, but when I open the bottom tab, the first one collapses, the second one opens, the focus remains in place. Website . I thought to find out the position relative to the window, and if not more or less than 10px, then set the position to top: 10, but I don’t understand how to do it.
Tell me please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lodas, 2018-02-08
@lodas

Something like this, experiment with the names of the blocks to descend to:

var body = $("html, body");
if(!$(".info_body2").is(':visible'))
            body.animate({scrollTop: $(".info_body2").offset().top }, 1100);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question