pointer-events: none VML raphael solution

半世苍凉 提交于 2019-11-30 09:14:57

问题


I have implemented pointer-events: none on a Raphael element using jQuery like this:

var raphaelElement = Raphael.ellipse(x,y,w,h);
$(raphaelElement.node).css({'pointer-events': 'none'});

This works fine but of course in IE8, Raphael uses VML instead of SVG and this solution fails.

Does anyone have another solution to essentially make a Raphael element ignore events.


回答1:


The only way to make this work for IE8 (and earlier) would be to actually catch the event, and in the event handler:

  1. hide the element (.style.display='none')
  2. use the elementFromPoint() method to find the next element below the 'catcher'
  3. re-create and fire the event on that element (see also this)
  4. show the catcher again (.style.display='')

This general approach (minus step 3) has been used for over 10 years on IE to allow the user to drag an element with it directly under the cursor while still detecting the 'mouseover' of possible drop target elements underneath.



来源:https://stackoverflow.com/questions/10951868/pointer-events-none-vml-raphael-solution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!