jquery hover event between mousedown and mouseup - possible?

Posted by Haroldo on Stack Overflow See other posts from Stack Overflow or by Haroldo
Published on 2010-04-19T13:25:18Z Indexed on 2010/04/19 13:33 UTC
Read the original article Hit count: 221

Filed under:

If you imagine in microsoft paint you can click and hold to paint in an area, id like to do a similar but adding a class to cells in a table:

(note this isnt for painting/art just an easy way of explaining it!)

the following isnt working...

$(function(){
    $('td').mousedown(function(){
    console.log('down');
      $('td').bind('hover', function(){
        $(this).addClass('booked');
      });
    })

    $('td').mouseup(function(){
       $('td').unbind('hover');
    });
})

© Stack Overflow or respective owner

Related posts about jQuery