D
D
Denis Klepko2018-01-24 19:32:10
JavaScript
Denis Klepko, 2018-01-24 19:32:10

Does scrolling work weird?

Hello!
On the site contora.tech/clients/capital/24 , clicking on the logo should scroll to the first screen.
For some reason, it reaches the top, and then rolls back. What to do with it?
At the first screen position: fixed
I make it scroll like this:

$(".logo").click(function(event) {
      $('html, body').animate({
            scrollTop: 0
        }, 1500);
    });

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
I'm Yoda, 2018-01-24
@gaz12

Your link with the logo falls under this condition

$(document).on('click', 'a[href^="#"]', function (event) {
...
}

Replace it
<a href="#top" class="logo"><img src="images/logo.png" alt="Еда"></a>
on the
<div class="logo"><img src="images/logo.png" alt="Еда"></div>

S
Semyon Kolipov, 2018-01-24
@nikanika77

Yes that's right

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question