【发布时间】:2014-02-27 08:36:09
【问题描述】:
在我的网页中,我有一个带有背景的块,下面有一个按钮,应该继续背景。
这是一个例子。左图是我的网页现在的样子,右图是网页应该的样子。可以看到按钮上的背景继续。
我的代码结构是这样的:
<div id="section-1">
<div class="shown-content">
<div class="background"></div>
<div class="content">
... here are shown contents ...
</div>
</div>
<div class="hidden-content">
... here are hidden contents ...
</div>
<div class="button-content">
<span class="button">FOLD OUT</span>
</div>
</div>
功能是当你点击按钮时,它会触发 JQuery slideToggle 并显示/隐藏 hidden-content div。
我的想法是将按钮背景设置为与内容背景相同的宽度和高度,然后将其放置在适当的位置。但是我有点迷茫,因为我没有找到任何方法,也许你知道更好的方法。
【问题讨论】:
-
你能不能做一个 jsfiddle.net 让我们看看有什么问题。 :)
-
jycr:有一张大图显示出了什么问题! ;)
标签: javascript jquery css background background-image