Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
741 views
in Technique[技术] by (71.8m points)

javascript - pointer-events: none VML raphael solution

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...