Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

118
Vistas
Scroll into view on swipe up for mobile device not working

In my webpage I have navigation options on top then further down in the middle of viewport there is another scrollable separate div for article. When visitors will start scrolling in the article div (art-container) the scrollintoview method will bring the div into center of viewport. To achieve this was easy on desktop but not in mobile browser. Touchmove, touchstart event alone didn't work as intended. I was trying to detect swipe up on mobile and finally the swipe up detection is working and I can make something visible and hidden using swipe up and down on mobile but why the scrollintoview function not working now. I tried scrollto which worked but scrollintoview not working. Please help me to solve this how to make it work and any other idea to get same the result ...?

HTML

<div class="articles-container" id="art-container" 
                    ontouchstart="touchStart(event)"
                    ontouchmove="touchMove(event)"
                    ontouchend="touchEnd()">

JAVASCRIPT

var startingX , startingY , movingX , movingY ;
                    function touchStart(evt)
                    {
                    startingX = evt.touches[0].clientX ;
                    startingY = evt.touches[0].clientY ;
                    }
                    function touchMove(evt)
                    {
                    movingX = evt.touches[0].clientX ;
                    movingY = evt.touches[0].clientY ;
                    }
                    function touchEnd()
                    { 
                    if(startingY+100 < movingY)
                    {
                        console.log('down');
                        document.getElementById("Ellipse_3").style.visibility = "visible";
                        document.getElementById("Ellipse_2").style.visibility = "hidden";
                    } 
                    else if(startingY-100 > movingY)
                    {
                        console.log('up'); // only scrollIntoView not working
                        document.getElementById("art-container").scrollIntoView({
                                block: 'center',
                                behavior: 'smooth'
                        });
                        // style changing on swipe up is working fine   
                        document.getElementById("Ellipse_2").style.visibility = "visible";
                        document.getElementById("Ellipse_3").style.visibility = "hidden";
                    }
                    }
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda