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

118
Views
¿Cómo dejar de desplazarse por la página cuando se nota un deslizamiento?

Creé un juego en el que cuando deslizo el lienzo cambia de dirección, pero al deslizar hacia abajo o hacia arriba en el lienzo, toda la página se desplaza, ¿cómo puedo evitar desplazarme solo en el lienzo, pero no fuera de la página?

 Area.addEventListener("touchstart", startTouch, false); Area.addEventListener("touchmove", moveTouch, false); // Swipe Up / Down / Left / Right var initialX = null; var initialY = null; function startTouch(e) { initialX = e.touches[0].clientX; initialY = e.touches[0].clientY; }; function moveTouch(e) { if (initialX === null) { return; } if (initialY === null) { return; } var currentX = e.touches[0].clientX; var currentY = e.touches[0].clientY; var diffX = initialX - currentX; var diffY = initialY - currentY; if (Math.abs(diffX) > Math.abs(diffY)) { // sliding horizontally if (diffX > 0) { // swiped left console.log("swiped left"); } else { // swiped right console.log("swiped right"); } } else { // sliding vertically if (diffY > 0) { // swiped up console.log("swiped up"); } else { // swiped down console.log("swiped down"); } } initialX = null; initialY = null; e.preventDefault(); };
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!