Triggering Raphael events externally

前端 未结 2 2052
栀梦
栀梦 2021-01-13 03:17

My app is using Raphaël to drop a collection of objects onto a page, each with a click handler bound that uses data attached to the object when it was loaded in

2条回答
  •  借酒劲吻你
    2021-01-13 04:11

    I found that first finding the raphael object, then traversing the DOM allowed me to find the functions of their event handlers. For mine, the click event was the 0th event.

    So to trigger it all I did was:

     raphobj.events[0].f();
    

    Be careful though, because if in the click event you reference 'this' it won't work.

提交回复
热议问题