【发布时间】:2014-01-16 06:07:04
【问题描述】:
我正在尝试使我在另一个 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 但没有任何效果。
【问题讨论】:
标签: javascript jquery html toggle fadeto