最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Impossible to set the rule "pointer-events" through JS or jQuery? - Stack Overflow

programmeradmin7浏览0评论

I've to manipulate the interaction with an element in runtime, making it invisible and "no interactible".. The rule that can acplish the second, is "pointer-events: none"

The problem is that it doesn't recognized from JS or jQuery... why?

I've to manipulate the interaction with an element in runtime, making it invisible and "no interactible".. The rule that can acplish the second, is "pointer-events: none"

The problem is that it doesn't recognized from JS or jQuery... why?

Share Improve this question asked Mar 8, 2013 at 13:46 SoniaSonia 2531 gold badge3 silver badges17 bronze badges 1
  • Which browser do you need this work work on? pointer-events are not natively supported on any version of IE – andyb Commented Mar 8, 2013 at 13:53
Add a ment  | 

2 Answers 2

Reset to default 21

I don't think I understand the question, but (using jQuery)

$( document.body ).css( 'pointer-events', 'none' );

will work just fine for supporting browsers (ignoring any pointer event). However, if you remove / hide the element, pointer events will of course also no longer work if you hide it by

display: none

You can use the css pointer-events: none; to allow events to go through. Also, like 1j01 mented, jquery will accept camelCase to get around the problem of dashes in the name:

$('.my-class').css({pointerEvents: "none"})
发布评论

评论列表(0)

  1. 暂无评论