javascript - Ionic 2 中的导航栏和标题内滑动

标签 javascript html angular ionic-framework ionic2

我想让我的标题内容成为一张幻灯片,当我向下滚动时,画廊被隐藏,我的导航栏现在像 gif 一样位于顶部。 我需要一些东西来开始这个想法,我感谢你的帮助。谢谢。

enter image description here

最佳答案

I hope this will help you.

<header>
  <div class="header-banner">
</div>

<nav>
<ul>
  <li><a href="#">$4,456-5,778 your text</a></li>
</ul>
</nav>
</header>
<section class="content">
  <p>Here add huge dummy content to check scroll position.</p>
</section>



 header {
 height:360px;
 }
.header-banner {
 background-color: red;
 width: 100%;
 height: 300px;
 }
 .fixed-header {
  position: fixed;
  top:0; left:0;
  width: 100%; 
  }
   nav {
  width:100%;
  height:60px;
  background: #292f36;
  postion:fixed;
  z-index:10;
  }
  nav ul { 
  list-style-type: none;
  margin: 0 auto;
  padding-left:0;
  text-align:right;
  width: 960px; 
  max-width: 100%;
  }
  nav ul li { 
  display: inline-block; 
  line-height: 60px;
  margin-left: 10px;
  }
  nav ul li a {
  text-decoration: none; 
  color: #a9abae;
  }


  $(window).scroll(function(){
if ($(window).scrollTop() >= 300) {
   $('nav').addClass('fixed-header');
}
else {
   $('nav').removeClass('fixed-header');
}
});

关于javascript - Ionic 2 中的导航栏和标题内滑动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45965137/

相关文章:

javascript - 在函数javascript中访问另一个函数的超时变量

javascript - Angularjs 未知提供程序错误 - $cookieStore 提供程序

javascript - jQuery无序列表元素点击选择器问题

javascript - net::ERR_EMPTY_RESPONSE 尝试在 angularjs 指令中查找 css 文件时

javascript - Angular 6 - 由于 NGRX,生产构建失败

javascript - 关于如何在 Javascript 中实现 'touchMoveOver' 事件有什么想法吗?

javascript - 如何使用 JavaScript 打开多个独立的浏览器窗口?

javascript - 使用正则表达式匹配和更改 html 元素的颜色

angular - 订阅cdk滚动策略事件

javascript - 无法通过保持输入文本宽度相同来增加 ng2-autocomplete 的宽度