R
R
rillkoff2021-06-08 20:06:34
JavaScript
rillkoff, 2021-06-08 20:06:34

Why jQuery scroll animation doesn't work?

It is required when clicking on the button to make a scroll to the element. The problem is that the element appears after clicking, and the scripts are not available to me for settimeout, I scrolled to the end of the block, above the required element, but for some reason the animation does not work and the scroll happens instantly.

$("about_economy_href").click(function() {
    $('html, body').animate({
        scrollTop: $("header_wrap").offset().top + $("header_wrap").height() + 2
    }, {
    duration: 370, 
        easing: "linear" 
  });
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Vasilyev, 2021-06-18
@Basil_Dev

scroll-behavior

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question