2014-02-25 58 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,那么你会怎么做,那么你的代码将无法工作 –

相关问题