我似乎無法弄清楚如何從底部向上顯示隱藏的內容,而不是從頂部向下顯示。我在這裏做了一些家庭作業,並且遇到了來自jQuery UI的解決方案,但必須實現它的錯誤。非常感謝任何幫助 - 新手腳本。使用.slideToggle從底部拉一個隱藏的div
乾杯!
這裏就是我與
工作的腳本:
$(document).ready(function() {
$('#clientsOpen').click(function() {
$('#clientsDropDown #clientsDashboard').slideToggle({ direction: "up" }, 300);
$(this).toggleClass('clientsClose');
}); // end click
});
標記:
<div id="clientsDropDown">
<div id="clientsDashboard">
<p id="clientsCTA">Let's make something beautiful together...<br /><a href="mailto:[email protected]">[email protected]</a></p>
</div><!-- /clientsDashboard -->
<p id="clientsOpen">clients</p>
</div><!-- //clientsDropDown -->
風格:
#clientsDropDown {
bottom:0;
width: 100%;
padding-bottom:2%;
z-index: 100;
}
#clientsOpen {
background: url("images/open.png") no-repeat scroll 68px 10px #414142;
color: #ececec;
cursor: pointer;
float: left;
font-size: 26px;
margin: -2px 0 0 10%;
padding: 0 15px 2px;
text-decoration: none;
width: 63px;
}
#clientsCTA {
background:#414142;
width:100%;
color: #CCCCCC;
text-align:center;
font-size: 46px;
margin: 0;
padding: 30px 0;
text-decoration: none;
}
#clientsDropDown .clientsClose {
background-image: url(images/close.png);
}
#clientsDropDown #clientsDashboard {
display: none;
}
從我可以做出來的,'slideToggle()'的默認值向上滑動,因此選項'direction:up'不需要。如果你從最上面的答案小提琴中刪除它,它仍然向上滑動。此外,對於'slideToggle()'函數''direction' [甚至沒有列出的選項](http://api.jquery.com/slidetoggle/#slideToggle-options)。 – verbumSapienti