ページの下部にhtml要素の一部を隠そうとしていますが、CSS3トランジションを介してクリックすると全体が上にスライドして表示されます。CSSのネガティブボトムプロパティを設定するとページ下部に表示されます
通常、ページの下に広がる要素の一部は隠されています。しかし、ページの要素がその要素の一部を示すように拡張されているだけです。
これを修正するにはどうすればよいですか?
HERESに私のコード:
HTML:
<div class="closed" id="slidePanel">
<div id="slidePanel-tab">
Stuff
</div>
<div id="slidePanel-contents">
<ol>
<li>stuff</li>
<li>stuff</li>
</ol>
</div>
</div>
CSS:
#slidePanel {
background-color: #e9e9e9;
position: absolute;
bottom: 0;
left: calc(50% - 66px);
z-index: 2;
min-width: 10%;
min-height: 20%;
border: 2px solid rgba(0, 0, 0, .05);
-webkit-transition: bottom 0.5s ease-in-out;
transition: bottom 0.5s ease-in-out;
}
#slidePanel.closed {
bottom: calc(-20% + 20px);
-webkit-transition: bottom 0.5s ease-in-out;
transition: bottom 0.5s ease-in-out;
}
#slidePanel-tab {
background-color: #d0d0d0;
}
$("#slidePanel-tab").click(function (evt) {
$("#slidePanel").toggleClass("closed");
evt.preventDefault();
});
相続人例: https://jsfiddle.net/sd306pyr/
body {overflow:hidden;} –