Find out which function is called in the click

0

I have a website in wordpress and I use Bootstrap 4.

In the footer I have a link back to the top of the page. When I click on it it shows the page animation going up.

I generated with javascript another link to go to the middle of the page. But the animation does not work, it already appears in the middle.

The links are identical

<a href="#topo">Topo</a>
<a href="#meio">Meio</a>

<div id="topo">conteúdo</div>
<div id="meio">conteúdo</div>

Does anyone know why the animation only works on the first link and not on the second link?

    
asked by anonymous 06.07.2018 / 23:45

1 answer

1

If with your generated with javasript another link , you mean that you are adding another button with javascript to go to the middle of the page, you need to apply the listener to this button, because the listener of the button you are using to go to the top has already been executed.

Or you can generate this button before applying the listener of your scroll animation for example.

    
07.07.2018 / 00:43