Anchor to another page with scroll to content

3

I have a link on a page that will send me to another page, but I need it when the requested page loads, make a scroll for the content I want to focus on.

If it was on the same page, it would not be a problem because I already do this at a certain point, but as they are on separate pages, I have no idea how to do it.

    
asked by anonymous 27.07.2015 / 21:37

2 answers

5

Scroll on the same page just place the element ID in href :

<a href="#id-do-elemento">Go</a>

To make another page the mechanism is really just add the ID at the end of the URL:

<a href="outra-pagina.html#id-do-elemento">Outra Página Go</a>
    
27.07.2015 / 21:42
3

The process is almost the same and very simple, just put nome_da_pagina#nome_da_ancora :

<a href="contato.html#maps">Nos encontre no mapa</a>

But if you do this redirect by javascript (by the tag of your question, that's what you mean), use:

location.href = 'contato.html#maps';
    
27.07.2015 / 21:43