2013-03-18 60 views
0

我有一些元素,在調度mouseenter時,它會創建一個使用帶有邊框的div來覆蓋所選元素的div。不允許div阻止父事件

事情是這樣的:

function attachSelectorBarTo(el){ 
      var bar = $('#editor-selection-bar'); 
      bar.css({ 
       top:el.offset().top, 
       left:el.offset().left 
       width:el.outerWidth(), 
       height:el.outerHeight() 
      }).show(); 
     } 
     $(function(){ 
      $('[editordata]').mouseenter(function(event){ 
       event.stopPropagation(); 
       attachSelectorBarTo($(this)); 
      }).mouseleave(function(){ 
       //hideSelectorBar(); 
      }); 
     }); 

但是,選擇DIV是一個絕對位置和Z指數比其他的greather。所以,當我嘗試選擇另一個元素時,下面的元素當然不會得到mouseneter事件。 我的問題是:有一種方法讓選擇器div不阻止其他元素事件?

回答

0

沒關係!我剛剛發現這個CSS屬性!

pointer-events:none;