WebSite X5Help Center

 
Michel M.
Michel M.
User

Center sections on screen after a click on an anchor  pt

Autor: Michel M.
Besucht 1287, Followers 1, Geteilt 0  

Hi,

I have a top menu on my page with full height rows enabled.

Links of that menu are using anchors to scroll to each page section, but unfortunatly sections are not always vertically centered on screen.

So, how can I get a similar result as if I did a click on little lateral sections dots?

Thank you very much.

Gepostet am
8 ANTWORTEN - 3 NüTZLICH - 1 KORREKT
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator

(It > Pt) ... para que eu entenda, você deve postar seu exemplo online com as características que você disse ...
... talvez você possa usar algum código EXTRA ...

ciao

.

Mehr lesen
Gepostet am von  ‪ KolAsim ‪ ‪
Michel M.
Michel M.
User
Autor

Hi KolAsim,


You can see by yourself what i'm talking about here (even if the site is not finished):

ez-team.com/v5/caracteristicas.html

The only extra code that I have is a simple: onload='location.href="#Controlo"' on the BODY, but even if I delete it scroll behavior remains the same.

Thank you for your help.

PS: Do not worry, you answer in english. That way maybe other users can benefit from a possible solution. ;-)

Mehr lesen
Gepostet am von Michel M.
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator
Michel M.
... ... ...  PS: Do not worry, you answer in english. That way maybe other users can benefit from a possible solution. ;-)

(It > Pt) ... pra mim é igual, eu só uso o Google Translate ...
............................
... as âncoras não podem funcionar bem, porque a página contém efeitos de posicionamento atrasados ​​e, portanto, não sendo capaz de calcular a coordenada absoluta ...
... eventualmente você pode simular no jQuery o clique nos pontos relativos ...
... por exemplo, para o terceiro (3) botão, tente esta string:
#" onclick="$( '#imPageRowBullets div:nth-child(3)' ).click()
... como expliquei a você no outro tópico ...
... se funcionar para você, então você usará as outras referências (1,2,3,4,5,6,7, etc ...)...

.

ciao

.

Mehr lesen
Gepostet am von  ‪ KolAsim ‪ ‪
Michel M.
Michel M.
User
Autor

You're my savior !!!

Thank you very much KolAsim. Your code works perfectly.

Maybe that option can be added to the LINK tab, where you define a link to a page or an anchor on that same page. just saying... ;-)

Mehr lesen
Gepostet am von Michel M.
Michel M.
Michel M.
User
Autor

Yes, my ideia is to add a new field like this:

https://prnt.sc/10necnl

I don't want to bother you, but how can I go directly to the first page section when page load?

On BODY if I add this:

onload='location.href="#\" onclick=\"$( \'#imPageRowBullets div:nth-child(1)\' ).click()"'

It will obviously not work. So I need to replace the onclick by what?

Thank you.


Mehr lesen
Gepostet am von Michel M.
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator

... atrasado por três (3) segundos, (3000)m ...
.... Especialista | Código personalizado da opção 4:
onload="setTimeout(function(){$( '#imPageRowBullets div:nth-child(1)' ).click()}, 3000);"

... ou ... Especialista | Código personalizado da opção 3:
<script> $(document) .ready (function () {
setTimeout (function () {$('#imPageRowBullets div: nth-child (1)') .click ()}, 3000);
}); </script>

.

ciao

.

Mehr lesen
Gepostet am von  ‪ KolAsim ‪ ‪
Michel M.
Michel M.
User
Autor

It works perfectly.

Thank you very much, once again!

Mehr lesen
Gepostet am von Michel M.