1
I would like to move the scroll bar to a specific point of the page by clicking on the site menu.
I managed to do with anchors.
jQuery(document).ready(function($) {
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 600);
});
});
<a href="#footer" class="scroll">Descer</a>
I’m trying to do by clicking on the menu but I haven’t been able to so far.
I do not see this question as duplicate identified, since it refers to clicking on the site menu, and not to a link outside the menu.
– Daniel
I don’t see how the location of the link would make a difference. If you want to ask "how do I automatically go to an anchor when loading the page", it’s another problem (but that’s completely different from your current question).
– Bacco
quiet, sorry then for asking wrong. Next time I will pay more attention on how to ask correctly so that there is no problem.
– Daniel
I’m not complaining, you don’t have to apologize. I’m just pointing out things you can improve on to get answers that are relevant to your problem. Remembering that if this is the case, you can [Dit] your post to add all the information that is relevant to the problem. The idea is that the easier it gets for the community to understand the exact problem, the greater the chance you get what you want, and at the same time the staff doesn’t waste time answering something that’s not what you expect.
– Bacco
PS: the way you repeated the question, got better and has come up with a better answer, I think. The idea is this, you better take advantage of the site, and the community can spend more time helping you objectively. Even when I made the first comment, I hadn’t even seen that one yet.
– Bacco
Yes, I’m learning programming and I really like this site because it has an answer for almost everything. I will learn to ask also correctly with time.
– Daniel