當我切換div下方顯示div下方的按鈕以不同/分開的方式顯示(大部分代碼來自另一個問題here)。它如何使它作爲包裝div的一部分一起滑出?謝謝。作爲一個整體顯示/隱藏/切換顯示div
CSS:
.more { display: none }
HTML:
<a href="#" id="showhide">Show more</a>
<div class="more" style="background-color:#f0f0f0;border:1px solid #d0d0d0;bottom:0px;display:none;height:30%;overflow:auto;padding:10px 10px 50px 10px;width:300px;position:fixed;right:0px;z-index:1;">
<div class="more1">
<h2>Risk Calculator</h2>
<p>Some text</p>
</div>
<div class="more2">
<h2>Some title</h2>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
</div>
<div class="more3">
<h2>Some title</h2>
<p>Some text</p>
</div>
<div style="background-color:#ccc;border:1px solid #ccc;bottom:0px;height:30px;padding:10px;position:fixed;right:0px;text-align:right;width:300px;">
<input type='button' value='button1' />
<input type='button' value='button2' />
</div>
</div>
的JavaScript:
$('#showhide').click(function(){
$('.more').toggle('slow')
})
看到它在撥弄http://jsfiddle.net/J2YgE/31/
雖然這不是我期待的答案,這是一個很大的變通。謝謝。 – 2014-09-15 15:41:26
我做到了,所以他們滑動你想要的方向,並更新小提琴。那是你在找什麼? – hellaminx 2014-09-15 17:03:40
是的,我正在玩弄你的建議,並使其工作就像你更新的解決方案。再次感謝。 – 2014-09-16 19:56:24