2014-07-21 40 views
1

無法使用以下CSS工作AJAX阻止div ...任何線索? 謝謝!AJAX阻止div問題

HTML

<div id="busy"></div> 

的JavaScript

$.ajaxSetup({ 
      beforeSend: function() { 
       $("#busy").show(); 
      }, 
      complete: function() { 
       $("#busy").hide(); 
      } 
     }); 

CSS

#busy { 
    width:100%; 
    height:100%; 
    opacity: 0.4; 
    filter: alpha(opacity=40); /* For IE8 and earlier */ 
    background-color:grey; 
    z-index:9999; 
} 

回答

3

你的元素有一個static位置,它需要被定位relativeabsolutefixed有尺寸

#busy { 
    position: absolute; 
    width:100%; 
    height:100%; 
    opacity: 0.4; 
    filter: alpha(opacity=40); /* For IE8 and earlier */ 
    background-color:grey; 
    z-index:9999; 
} 
+0

謝謝!現在工作正常。 –