直奔代码主题
wxml:

<view class="test_box">

<swiper indicator-dots="{{indicatorDots}}"

autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" >

<swiper-item>

<view class='ceng'>

<image src="{{mdc_videofenmian}}" hidden="{{xiaoshi}}"/>

<view class='btn'><image src="/img/play.png" hidden="{{xiaoshi}}" bindtap="bindPlay" /></view>

<video src="{{mdc_video}}" objectFit="cover" bindtouchmove="mdc_move1" controls id="mdcVideo" style="width:100%;height:100% " hidden="{{mdc_show}}" >

<cover-view class='mdc_return' bindtap='returnquanping'>退出全屏</cover-view>

</video>

</view>

</swiper-item>

<block wx:for="{{imgUrls}}">

<swiper-item>

<image src="{{item}}"/>

</swiper-item>

</block>

</swiper>

</view>

wxss:

// pages/test/test.js

Page({

/**

* 页面的初始数据

*/

data: {

//swiper循环图片地址路径

imgUrls: [

'/img/01.jpg',

'/img/02.jpg',

'/img/03.jpg'

],

indicatorDots: false,

autoplay: false,

interval: 5000,

duration: 1000,

//视频路径

mdc_video:'https://cloud.video.taobao.com/play/u/576446681/p/1/e/6/t/1/50140370746.mp4',

//替换视频的封面图

mdc_videofenmian:'/img/f2.png',

// 视频的封面图显示消失的参数

xiaoshi:false,

// 视频显示消失的参数

mdc_show:true,

},

/**

* 生命周期函数--监听页面加载

*/

onLoad: function (options) {

},

// 封面点击的时候相应的操作  获取视频在JS里的参数属性

//重点:点击图片接下来视频进行播放,但是视频播放后直接触发了视频的pause() 结局的方案是,延时150ms后再进行视频的播放,就完美解决了

bindPlay:function(e){

var that =this;

that.videoContext = wx.createVideoContext('mdcVideo');

// that.videoContext.play()

that.videoContext.pause();

setTimeout(function () {

that.videoContext.play()

}, 150);

that.setData({

xiaoshi:true,

mdc_show:false

})

},

//安卓系统能检测到 video touchemove 滑动的x距离,已此作为切换的swiper的凭证

//ios系统,检测不到video touchemove 滑动的x距离,通过cover-view 点击事件进行切换

mdc_move1: function (e) {

var that = this;

console.log(e)

console.log(e.touches[0].pageX)

that.videoContext = wx.createVideoContext('mdcVideo');

if (e.touches[0].clientX > 20) {

console.log(5555555555555555)

// that.videoContext.pause();

that.setData({

xiaoshi: false,

mdc_show: true,

})

}

},

returnquanping:function(e){

var that = this;

that.setData({

xiaoshi: false,

mdc_show: true,

})

}

})

以上代码亲测可用

 

小程序 swiper 轮播图滚动图片 + 视频的更多相关文章

  1. 如何自定义微信小程序swiper轮播图面板指示点的样式

    https://www.cnblogs.com/myboogle/p/6278163.html 微信小程序的swiper组件是滑块视图容器,也就是说平常我们看到的轮播图就可以用它来做,不过这个组件有很 ...

  2. 自定义微信小程序swiper轮播图面板指示点的样式

    微信小程序的swiper组件是滑块视图容器,也就是说平常我们看到的轮播图就可以用它来做,不过这个组件有很多样式是固定的,但是,有时候我们的设计稿的面板指示点是需要个性化的,那么如何去修改swiper组 ...

  3. 微信小程序的轮播图swiper问题

    微信小程序的轮播图swiper,调用后,怎样覆盖系统的 点,达到自己想要的效果 不多说,先上一图望大家多给意见: 这个是效果图: 微信小程序效果图就成这样子: <view class=" ...

  4. 微信小程序3D轮播图

    <!-- 轮播图 --> <swiper previous-margin='50px' next-margin='50px' bindchange="swiperChang ...

  5. 【自定义轮播图】微信小程序自定义轮播图无缝滚动

    先试试效果,可以通过设置参数调整样式 微信小程序中的轮播图可以直接使用swiper组件,如下: <swiper indicator-dots="{{indicatorDots}}&qu ...

  6. 微信小程序 - 3d轮播图组件(基础)

    <!-- 目前仅支持data数据源来自banner,请看测试案例 ################ 以上三种形式轮播: 1. basic 2. 3d 3. book basic即普通轮播 3d即 ...

  7. 微信小程序 swiper轮播 自定义indicator-dots样式

    index.wxml <view class="swiperContainer"> <swiper bindchange="swiperChange&q ...

  8. 微信小程序_(组件)swiper轮播图

    微信小程序swiper轮播图组件官方文档 传送门 Learn: swiper组件 一.swiper组件 indicator-dots:是否显示面板指示点[默认值false] autoplay:是否自动 ...

  9. Swiper轮播图

    今天咱们来说一下.Swiper轮播图. 超级简单的: 翠花,上代码:   <!DOCTYPE html>   <html lang="en">   < ...

随机推荐

  1. Hystrix服务容错保护

    一.什么是灾难性雪崩效应? 造成灾难性雪崩效应的原因,可以简单归结为下述三种: 服务提供者不可用.如:硬件故障.程序BUG.缓存击穿.并发请求量过大等. 重试加大流量.如:用户重试.代码重试逻辑等. ...

  2. Boot-crm管理系统开发教程(三)

    (ps:前两章我们已经把管理员登录和查看用户的功能实现了,那么今天我们将要实现:添加用户,删除用户,和修改用户功能) 由于Cusomer的POJO类型已经写好了,所以这次我们之前从CustomerCo ...

  3. 植物大战僵尸:寻找阳光掉落Call调用

    实验目标:通过遍历阳光产生的时间,寻找阳光产生的本地Call,使用代码注入器注入,自定义生成阳光 阳光CALL遍历技巧: 进入植物大战僵尸-> 当出现阳光后->马上搜索未知初始数值 返回游 ...

  4. Zend 3.3.0安装 ZendOptimizer 3.3.0 for Windows 稳定版 下载

    用的某php网站系统今天打开时乱码了(zend 200407...),但phpmyadmin能正常使用: 搜索下,重新安装zend可以解决,系统上原来的版本是Zend 3.3.0:下了个,安装后果然把 ...

  5. 使用.netcore部署window服务完成过程(使用nssm,Topshelf)

    一,新建.netcore控制台应用程序.本文使用.netcore2.2版本,结构如下 二,negut引用Topshelf.Log4Net,Topshelf 三,代码如下:1>Program.cs ...

  6. linq to sql之Distinct

    Distict用来排除相同序列中元素的,对于基础类型,可以直接使用Distinct,如:int[] a = {1, 2, 2, 3, 3, 3, 4};var reslut = a.Distinct( ...

  7. js循环遍历性能

    定length for循环 (有length) 不定length for循环(使用数组length) 不定length for循环(判断数组length是否存在) forEach(Array自带,对某 ...

  8. 谁是嫌疑犯问题Python枚举法

    原文:https://blog.csdn.net/yunzifengqing/article/details/81941592 问题描述:有6名犯罪嫌疑人A.B.C.D.E.F,已知如下事实: A.B ...

  9. 06 Go语言基本命令

    在命令行执行go命令查看相关的Go语言命令: 以windows为例,在DOS窗口输入go Go is a tool for managing Go source code. Usage: go com ...

  10. 浅谈RPC框架

    RPC(Remote Promote Call) RPC(Remote Promote Call):一种进程间通信方式.允许像调用本地服务一样调用远程服务. RPC框架的主要目标就是让远程服务调用更简 ...