html模仿抖音,仿抖音示例

scroll-video

uniapp仿抖音视频滑动效果

重要说明

插件分别用swiper实现(多端)和css3动画实现(只支持app,强烈推荐),可自行切换。

插件在uni-app编译模式下编写。

默认为weex编译模式,在 manifest.json 的源码视图里配置是切换模式, manifest.json -> app-plus -> nvueCompiler 切换编译模式。

功能说明

ccs3:上下切换视频,左右查看看详情,weex-bindingx优化动画,无限加载,点击暂停,仅支持安卓和ios

swpier: 上下切换视频,多端兼容

css3参数说明

参数

类型

默认值

说明

typeX

Boolean

false

是否开启左右滑动

playCount

Number

2

剩余多少视频加载视频列表

startDistance

Number

5

开启左右滑动时有效,判断左右上下拖动的启动距离 px

minTime

Number

300

判断为快速滑动的时间,该时间内无视回弹 ms

backDistance

Number

200

上下滑动的回弹距离 px

1.0.0更新内容

1.视频滑动效果

2.视频滑动后自动播放和暂停功能

3.点击暂停与播放

4.视频拖动效果

5.解决iostouch无效

6.点赞功能

1.1.0更新内容

1.更改uni-app编译模式下使用swiper组件实现。

1.2.0更新内容

1.新增css3实现效果

2.css3支持点击播放和暂停功能

3.移除swiper中点击视频播放和暂停事件,尽量减少swiper中的事件

4.index索引首视频设置为自动播放

5.新增进度条

6.修复h5多个视频播放问题

1.3.0更新内容

1.css3: 引入BindingX优化拖动性能

2.修复进度条

3.优化css3样式

4.css3新增无限加载

1.4.0更新内容

1.swiper:修复下滑不灵敏的bug

2.css3:新增参数说明,新增左右滑动查看详情

3.video组件新增上下边框阴影

如果觉得插件不错,麻烦给个好评

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是一个简单的仿抖音推荐页UI布局的HTML5代码: ``` <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>仿抖音推荐页</title> <style> body { margin: 0; padding: 0; } nav { height: 48px; background-color: #eeeff1; display: flex; align-items: center; padding: 0 16px; } nav input[type="text"] { flex-grow: 1; height: 30px; margin: 0 12px; border-radius: 15px; border: none; padding: 0 16px; background-color: #f4f5f6; font-size: 14px; color: #333; outline: none; } nav button { height: 30px; width: 60px; background-color: #ff7060; border-radius: 15px; border: none; color: #fff; font-size: 14px; outline: none; cursor: pointer; } .content { margin-top: 16px; display: flex; flex-wrap: wrap; justify-content: space-between; padding: 0 16px; } .video { width: 48%; margin-bottom: 16px; position: relative; } .video img { width: 100%; border-radius: 8px; object-fit: cover; object-position: center; cursor: pointer; } .video .play-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 50px; height: 50px; background-color: rgba(0,0,0,0.6); border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; } .video .play-btn i { color: #fff; font-size: 24px; line-height: 1; } .follow { margin-top: 16px; background-color: #fff; border-radius: 8px; padding: 16px; display: flex; align-items: center; } .follow .title { font-size: 16px; font-weight: bold; } .follow .avatar { width: 60px; height: 60px; border-radius: 50%; margin-left: 12px; object-fit: cover; object-position: center; cursor: pointer; } .follow .name { font-size: 14px; color: #666; margin-top: 8px; } .tab { height: 60px; background-color: #fff; display: flex; align-items: center; justify-content: space-around; position: fixed; bottom: 0; left: 0; right: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.1); } .tab-item { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #999; font-size: 12px; cursor: pointer; } .tab-item.active { color: #ff7060; } </style> </head> <body> <nav> <button>发布</button> <input type="text" placeholder="搜索" /> <button>消息</button> <button>个人中心</button> </nav> <div class="content"> <div class="video"> <img src="https://via.placeholder.com/300x400" /> <div class="play-btn"> <i class="iconfont icon-play"></i> </div> </div> <div class="video"> <img src="https://via.placeholder.com/300x400" /> <div class="play-btn"> <i class="iconfont icon-play"></i> </div> </div> <div class="video"> <img src="https://via.placeholder.com/300x400" /> <div class="play-btn"> <i class="iconfont icon-play"></i> </div> </div> <div class="video"> <img src="https://via.placeholder.com/300x400" /> <div class="play-btn"> <i class="iconfont icon-play"></i> </div> </div> <div class="video"> <img src="https://via.placeholder.com/300x400" /> <div class="play-btn"> <i class="iconfont icon-play"></i> </div> </div> <div class="video"> <img src="https://via.placeholder.com/300x400" /> <div class="play-btn"> <i class="iconfont icon-play"></i> </div> </div> </div> <div class="follow"> <div class="title">关注</div> <img class="avatar" src="https://via.placeholder.com/60x60" /> <div class="name">博主昵称</div> </div> <div class="tab"> <div class="tab-item active"> <i class="iconfont icon-home"></i> 首页 </div> <div class="tab-item"> <i class="iconfont icon-location"></i> 同城 </div> <div class="tab-item"> <i class="iconfont icon-message"></i> 消息 </div> <div class="tab-item"> <i class="iconfont icon-my"></i> 我 </div> </div> </body> </html> ``` 这只是一个简单的示例,你可以根据自己的需求对其进行修改和完善。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值