微信小程序--头部导航滑动 - 新闻资讯 - 云南小程序开发|云南软件开发|云南网站建设-昆明葵宇信息科技有限公司

159-8711-8523

云南网建设/小程序开发/软件开发

知识

不管是网站,软件还是小程序,都要直接或间接能为您产生价值,我们在追求其视觉表现的同时,更侧重于功能的便捷,营销的便利,运营的高效,让网站成为营销工具,让软件能切实提升企业内部管理水平和效率。优秀的程序为后期升级提供便捷的支持!

您当前位置>首页 » 新闻资讯 » 小程序相关 >

微信小程序--头部导航滑动

发表时间:2021-3-31

发布人:葵宇科技

浏览次数:39

项目需求:实现头部导航,可左右滑动。

  1. <view class="top-news">
  2. <view class="self-box">
  3. <view class="img-self">
  4. <image src="../../images/self.jpg"></image>
  5. </view>
  6. </view>
  7. <view class="self-add">
  8. <view class="img-add">
  9. <image src="../../images/add.jpg"></image>
  10. </view>
  11. </view>
  12. <view class="nav-scroll">
  13. <scroll-view class="scroll-view_H" scroll-x="true" style="width: 100%">
  14. <text wx:for="{{section}}" wx:key="id" id="{{item.id}}" catchtap="handleTap" class="nav-name {{item.id == currentId ? 'nav-hover' : ''}}">{{item.name}}</text>
  15. </scroll-view>
  16. </view>
  17. </view>
  1. /* 头部滑动导航 */
  2. .top-news{width:100%;height: 50px;border-bottom:1px solid #349393;position: fixed;top:0;left:0;z-index: 999;overflow: hidden;background: linear-gradient(to right,#f3f3f3,#fff,#f3f3f3); }
  3. .self-box{position: absolute;left:0;height:50px;width:40px;display: inline-block;background: #fff;}
  4. .img-self{width:30px;height: 30px;padding-top:10px;padding-left: 5px;}
  5. .img-self image{width:100%;height: 100%;}
  6. .self-add{position: absolute;right:0;height:50px;width:40px;display: inline-block;background: #fff;}
  7. .img-add{width:30px;height: 30px;padding-top:10px;padding-left: 5px;}
  8. .img-add image{width:100%;height: 100%;}
  9. .scroll-view_H{white-space:nowrap;width: 100%;padding:6px 40px 0;box-sizing: border-box;}
  10. .nav-name{display:inline-block;font-size:16px;color: #2b2e33;border-bottom: 2px solid transparent;padding:10px;}
  11. .nav-hover{color: #349393;/* border-bottom: 2px solid #f06000; */}
  1. data: {
  2. section: [
  3. { name: '精选', id: '1001' }, { name: '黄金单身汉', id: '1032' },
  4. { name: '综艺', id: '1003' }, { name: '电视剧', id: '1004' },
  5. { name: '电影', id: '1005' }, { name: '少儿', id: '1021' }
  6. ]
  7. },

相关案例查看更多