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

101
Visualizações
Make jquery.eraser work on hover rather than click

I am using jQuery.eraser which works well to erase an image. But it works on click rather than hover. I thought I would be able to trigger a click on hover so it clicked where the mouse is. But what I have tried is not working. I am presuming I need to feed it some coordinates to work?

This is what I have tried:

$( "#image1" ).on('mouseenter mouseleave', function(){ 

$(this).trigger( "click" );

})

Here is a fiddle of a working example.

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

0

In the "bind events" section of eraser code, replace the bindings to the following:

$canvas.bind('mouseenter.eraser', methods.mouseDown);
$canvas.bind('mouseenter.eraser', methods.touchStart);
$canvas.bind('touchmove.eraser', methods.touchMove);
$canvas.bind('mouseleave.eraser', methods.touchEnd);

This seems to work on a laptop, however you should be aware that this is a quick and ugly fix, I am not sure how it will behave on mobile devices, and you should think twice before using it.

Demo: https://jsfiddle.net/q49w1cuj/

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