Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!