当您单击某些内容时,我正在尝试使我在另一个 div 之上的 div 显示出来。
这是两个 div 的代码,没有每个 div 中的所有内容:
<div id="randomarticle_enlarge">
<h1></h1>
<h4></h4>
<p></p>
<p></p>
</div>
<div class="bodybag">
<h1></h1>
<h4></h4>
<p></p>
<p></p>
</div>
然后我每个都有 css,当然:
.bodybag {
width:960px;
}
#randomarticle_englarge {
height:750px;
width:960px;
position:absolute;
z-index:2;
margin-top:1px;
padding-left:20px;
padding-right:20px;
display: none;
}
我应该让 bodybag 类有一个 z-index 和一个 position:relative 吗?因为即使我不工作(此时)。
无论如何,我写了这个脚本,它正在做我想要它做的事情:
$(document).ready(function() {
$('.popular').click(function() {
$('#textmask').fadeTo( 'fast', 0.1);
$('#backgroundmask').css('background-color', 'white');
});
});
接下来我想要发生的是,随着 textmask 和 backgroundmask 淡入/改变它们应该和做的,是为了显示 randomarticle_enlarge div。
我尝试使用 .toggle 和 .toggleClass 以及 .slideToggle 和 .show 但没有任何效果。