2014-02-25 99 views

回答

0

你不能強制一個窗口通過JS強加在其他窗口之上,你也不應該。

0

如果Date-picker窗口引用html中的元素,那麼這應該做到這一點。

CSS日期格

z-index: 20; 

CSS的其他分區

z-index: 10; 

然後你只顯示或隱藏日期DIV,它會永遠留在上面。

你需要它來顯示,但不是在上面,z-index更改爲比其他分區

較低的值。如果您沒有訪問所有div的Z-index設置,無論是檢查這個帖子,How can you figure out the highest z-index in your document?,看看你可以嘗試找到最高或簡單地設置您的日期選擇器,即z-index: 10000

UPDATE

如果你想有一個模式對話框彈出DIV,這是該

演示開始:http://codepen.io/anon/pen/BLvcK

的jQuery(來源:http://jqueryui.com/dialog/#modal

<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> 
    <script src="//code.jquery.com/jquery-1.9.1.js"></script> 
    <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> 
    <link rel="stylesheet" href="/resources/demos/style.css"> 
    <script> 
    $(function() { 
    $("#dialog-modal").dialog({ 
     height: 140, 
     modal: true 
    }); 
    }); 
    </script> 

HTML

<div id="dialog-modal" title="Basic modal dialog"> 
    <p>Adding the modal overlay screen makes the dialog look more prominent because it dims out the page content.</p> 
</div> 

<p>Sed vel diam id libero <a href="http://example.com">rutrum convallis</a>. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.</p> 
+0

你怎麼可以指定的z-index爲20或10,而不碼 –

+0

您在第一時間將其設置在CSS 。由於日期選擇器很可能總是需要排在最前面,因此無需改變這一點。 – LGSon

+0

如果div的z-index爲1020,datepicker的div元素爲653,那麼你會怎麼做,那麼你的代碼將無法工作 –

相關問題