微信小程序 scroll

阅读: 评论:0

微信小程序 scroll

微信小程序 scroll

1.scroll-view 中的需要滑动的元素不可以用 float 浮动使其一行展示;

2.包裹scroll-view的元素如果用 display:flex; 是没有滚动效果的;

3.scroll-view 中的需要滑动的元素要用 dislay:inline-block; 进行元素的横向编排;

4.包裹 scroll-view 的元素要加上样式–> overflow:hidden;white-space:nowrap;

5.有时候为了美观要隐藏滚动条,需要在样式里加上

::-webkit-scrollbar {width: 0;height: 0;color: transparent;
}

最后的代码如下:

<view class='scroll-box'><scroll-view scroll-x class='index-nav-scroll'><view wx:for="{{nvaIndex}}" id='{{index}}' class='index-nav-view'>{{item}}</view></scroll-view>
</view>
.scroll-box {position: fixed;width: 100%;overflow: hidden;white-space: nowrap;border-top: 1px solid #d1d4d4; border-bottom: 1px solid #d1d4d4;color: #515151;
}
.index-nav-scroll {width: 100%;height: 75rpx;line-height: 75rpx;padding: 8rpx 0rpx;
}
.index-nav-view {display: inline-block;margin: 0rpx 22rpx;
}
::-webkit-scrollbar {width: 0;height: 0;color: transparent;
}

本文发布于:2024-01-31 21:59:08,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170670955031638.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:程序   微信小   scroll
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23