0

I am trying to remove hover and click for a svg element(Raphael). Just wrote a sample example (didn't verified syntax error please pardon me), whenever the updateBox function executes it adds hover and click (below example is just piece of code to describe my problem,i could avoid having the hover and click but in our real project we dont want to remove them for a reason). I tried unbinding also hover function with empty return but still we see the hover action when the mouse enters and leaves.

function updateBox() {
  var helperRect = _drawOptions.paper.rect(bbox.x - 1, bbox.y - 1,
                   (bboxWidth !== 0 ? bboxWidth + 2 : 3),
                   (bboxHeight !== 0 ? bboxHeight + 2 : 3));
  helperRect.attr(Configuration.getAttributes("helperRect"));
  helperRect.hover(_hoverOverEl, _hoverOutEl);
  helperRect.click(_clickEl);
  if(a==p)
    helperRect = _updateDocHeader(helperRect);
}

function _updateDocHeader(hb) {
  hb = $.extend(hb, {
    documentId : _paperProperties.header.documentId,
    docSlideNo : _paperOptions.whiteboard.docEl.docSlideNo,
    docTitle : _paperProperties.header.docTitle,
    //set order no to 0
    orderNo: 0
  });
  hb.hover(function(){return false;},function(){return false;});
  //$(hb).unbind('mouseenter mouaseleave click');
  return hb;
};
Mohammad Areeb Siddiqui
  • 9,083
  • 10
  • 62
  • 108
user1595858
  • 3,218
  • 12
  • 51
  • 96

2 Answers2

0

The .hover() method binds a handler to an element. If you call it twice, it will attach two handlers to the element. Both handlers will be executed on that action. Please refer to this question on how to unbind the handler.

Edit: It should be $(selector for your element).off('mouseenter').off('mouseleave');

Community
  • 1
  • 1
Sumurai8
  • 18,213
  • 9
  • 58
  • 88
0

Looks like the asker was looking for unhover and unclick specifically for RaphaelJS:

unhover - http://raphaeljs.com/reference.html#Element.unhover

unclick - http://raphaeljs.com/reference.html#Element.unclick

projeqht
  • 3,167
  • 3
  • 15
  • 32