2013-07-31 98 views
0

我使用DataTables jQuery插件來顯示網格。我有一個模式彈出窗口,它改變了整個窗體的背景色,並且偶然地改變了前面提到的表格標題&頁腳背景色的背景顏色。這是用來初始化彈出代碼:DataTables插件意外更改頁眉和頁腳背景顏色

var modalBackground = $("#modalBackground"); 
var Notifications_ArchiveHolder = $("#Notifications_ArchiveHolder"); 
var Notifications_ShowArchivePopupHolder = $("#Notifications_ShowArchivePopupHolder"); 
var ArchiveURL = "@Url.Action("Archive")"; 
var ShowArchiveUrl = "@Url.Action("ShowArchive")"; 

function ShowArchivePopup() {   
    $.get(ArchiveURL, function (content) { 
     if (Notifications_ArchiveHolder.html().length <= 10) { 
      Notifications_ArchiveHolder.html(content); 
      InitArchivePopup(); 
     } 
    }) 
} 

function InitArchivePopup() {  
    modalBackground.show(); 
    //set up positon 
    var h = $(window).height(); 
    var w = $(window).width(); 
    var hh = Notifications_ArchiveHolder.height(); 
    var hw = Notifications_ArchiveHolder.width(); 
    var posx = (h/2) - 100; 
    var posy = (w/2) - 200; 
    Notifications_ArchiveHolder.css("position", "fixed"); 
    Notifications_ArchiveHolder.css("top", posx); 
    Notifications_ArchiveHolder.css("left", posy); 

    Notifications_ArchiveHolder.show(); 
    $("body").css("overflow", "hidden"); 
} 

彈出在以下的div主辦:

<div id="Notifications_ArchiveHolder" style="background-color: white; display: none; z-index: 9999;"></div> 

,這是誰的CSS類使得整個背景灰色的股利,也改變了我表的頁眉頁腳&背景色:

<div id="modalBackground" class="graphicScreen" style="display: none; position: fixed; top: 0px; left: 0px;"></div> 

.graphicScreen 
{ 
position: fixed; 
width: 100%; 
height: 100%; 
margin: 0; 
padding: 50px; 
background-color: #878786; 
z-index: 9990; 
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"; 
filter: alpha(opacity=30); 
-moz-opacity: 0.3; 
-khtml-opacity: 0.3; 
opacity: 0.3; 
} 

任何想法,爲什麼出現這種情況,如何預防呢? 在此先感謝。

回答

1

我發現這個問題(有一些幫助):我在模態彈出框中引用了jQuery-UI.css,這導致覆蓋了數據表的屬性。很好奇..