A
A
ant422022-01-22 21:51:13
JavaScript
ant42, 2022-01-22 21:51:13

How to set up smooth scrolling from a fixed adsense ad?

Hello, help me solve the problem. I have a script for smooth scrolling on the site when clicking on the anchor:

$(".navi2 a").click(function () {
elementClick = $(this).attr("href")
destination = $(elementClick).offset( ).top;
$("html,body").stop().animate({scrollTop: destination - 10}, 500);
return false;
});

Now I have added fixed adsense mobile ads to the site https://support.google.com/admanager/answer/104522... . They appear on top (leave) when the content is scrolled a little.

Now it turns out that when you click on the anchor, there is a smooth scrolling to the desired place and an adsense block appears, which closes part of the content.

How can I make scrolling from this block, and not from the edge of the page? After loading the page in the browser, the adsense block is initially hidden. It only appears after a little scrolling.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question