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

100
Views
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 answers
Answer question

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 Report
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!