【发布时间】:2019-05-13 05:15:46
【问题描述】:
在我的角度应用程序中,我的标题与格式一样,
-- Header --
-- Sub header --
-- Search Box --
-- Create and Search Button --
-- Scroll Div --
HTML:
<h1> Header </h1>
<h3> Sub header </h3>
<div class="search-box-wrapper">
<input class="search-box" type="text" placeholder="search"> <br><br><br>
<button type="button"> Create </button>
<button type="button"> Search </button> <br><br>
</div>
<div class="scroll-div">
<ul>
<li> <h1> User One </h1> </li>
<li> <h1> User Two </h1> </li>
<li> <h1> User Three </h1> </li>
<li> <h1> User Four </h1> </li>
<li> <h1> User Five </h1> </li>
<li> <h1> User Six </h1> </li>
<li> <h1> User Seven </h1> </li>
<li> <h1> User Eight </h1> </li>
<li> <h1> User Nine </h1> </li>
<li> <h1> User Ten </h1> </li>
</ul>
</div>
CSS:
.search-box {
border-radius: 25px;
border: 5px solid #000;
padding: 10px;
width: 90%;
}
.scroll-div {
height: calc(100vh - 400px);
overflow: scroll;
}
和工作堆栈闪电战 https://stackblitz.com/edit/angular-vhnt8q
这里我有一个类名为scroll-div 的div,其中列表项可滚动..
如果我开始滚动,那么我需要缩小search-wrapper(创建和搜索按钮被隐藏)..
再次滚动到最高点应该是正常的..
预期的输出类似于谷歌搜索..
初始搜索结果会像,
而在 scroll start 上它会像这样收缩,
以同样的方式,我需要在滚动开始时隐藏创建和搜索按钮并仅显示搜索框(缩小),并且在滚动顶部再次需要显示创建和搜索按钮..
请帮助我实现预期的结果无需 jquery ..
任何角度方式的结果都会对我有更多帮助..
【问题讨论】:
-
你的意思是粘性导航栏?
-
兄弟,您是否在没有 jquery 或第三方库的情况下使用纯 angular 和 typescript 在任何滑块中进行了锻炼?如果您有或找到任何请分享链接兄弟..
-
@Chellappan,谢谢兄弟..
标签: javascript html css angular typescript