problems with anchors in firefox [closed]

1

I have problems with anchors in firefox

I pass the url link

the code you used was to put a button or class p in the html Upload

and the script you use is:

</script>
        <script type="text/javascript">

        (function () {

            //En el primer caso, hacemos funcionar el ancla del footer
            $('#to-top').click(function(event) { //Cuando haga click en el elemento que tiene el id "to-top"...

                $('body').animate({  //Uso el metodo animate en el body...
                    scrollTop: 0  // para mover el scroll del body hasta la posicion 0 (Arriba de todo).
                }, 3000, function () { //La animación va a durar 2 segundos (2s = 2000 milisegundos)
                    console.log('animation completed!!!!');  //Y cuando termine la animación voy a ejecutar la funcion que me avise por consola.
                });

            })

            //Ahora, un poco mas complicado
            $('.anchor').click(function(event) { //Cuando haga click en CUALQUIER elemento que tenga la clase "anchor"

                event.preventDefault(); // Evito el comportamiento por default de los links

                var sectionName = $(this).attr('href'); //Tomo la sección a donde quiero ir con el href

                var newPos = $('#'+sectionName).position().top; //Averiguo la posicion en donde está ese elemento

                $('.container').animate({
                    scrollTop: newPos //Y voy hasta ahi :)
                }, 800)

            })

        })()



    </script>

I also have problems in how the section is displayed

    
asked by Mariano Andrés Franco 16.06.2017 в 17:19
source

0 answers