Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

190
Visualizações
"touchstart" event used for a "doubletap" prevents scroll working on swipe up or down

I added a "touchstart" event to a "tbody" so a function ocurrs when I doubletap on a row. This works perfectly BUT prevents scroll up or down in mobile (so if my table has enough rows, you'll get stuck)

//DoubleClick not working on doubleTap, so...
$("tbody").on("touchstart", tapHandler);
var tapedTwice = false;
function tapHandler(e) {
    
    if(!tapedTwice) {
        tapedTwice = true;
        setTimeout( function() { tapedTwice = false; }, 300 ); //doubletap speed
        return false;
    }
    e.preventDefault();//Prevents zoom, but without it, scroll still not working
    lightboxPrint(e);  //Fx for this event
 }

Already try deleting all CSS and Bootstrap. Only function that gives promblems is this one. If this can be fixed, can I add a new event for "swipe up" or "swipe down" to scroll?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I'm answering with Terry's words, just to close the question. He should get full credit. Instead of starting with "tapedTwice = false", I just started with "tapedTwice = true" and change the funtion accordingly.

$("tbody").on("touchstart", tapHandler);
var tapedTwice = true;
function tapHandler(e) {
    
    if(tapedTwice) {
        tapedTwice = false;
        setTimeout( function() { tapedTwice = true; }, 300 );
        return true;
    }
    e.preventDefault();//Para evitar el zoom
    lightboxPrint(e);  
};
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda