我试着做到以下几点: - 点击一个链接触发,将.show调光了我的整个背景DIV(#分页盖)的功能。这div有999 的z-index - 然后我想另一个DIV(#red)以较高的z-indexjQuery的 - 暗淡整个页面和淡入淡出一个div元素
我的CSS在暗淡的背景/ fadeup /显示显示:
#page-cover {
display: none;
position: fixed;
width: 100%;
height: 100%;
background-color: #000;
z-index: 999;
top: 0;
left: 0;
}
#red {
background-color: red;
width: 100px;
height: 100px;
}
像预想的那样HTML
//Triggering link
<a href="#" onclick="dimBackground("Element1")">Element 1</a>
//Div to appear upon dimmed DIV
<div id="red">hejsa</div>
//Dimming DIV
<div id="page-cover"></div>
jQuery的
function dimBackground() {
$("#page-cover").css("opacity",0.6).fadeIn(300, function() {
//Attempting to set/make #red appear upon the dimmed DIV
$('#red').css('zIndex', 10000);
});
}
页盖渐强,但是我没有之后再没有任何成功让#red出现。
有什么建议?
你有没有找到解决方案? – anam 2014-05-15 07:15:40