swiper切换 video视频自动暂停

//swiper代码如下

//swiper切换按钮
  <!-- <a class="arrow-left-1" href="javascript:;"> <img src="/templets/1/lysrmzf/img/left_btn.png" alt=""> </a>
<a class="arrow-right-1" href="javascript:;"> <img src="/templets/1/lysrmzf/img/right_btn.png" alt=""> </a> -->
              
  <div class="swiper swiper1">
      <div class="swiper-wrapper">
        <div class="swiper-slide">
          <video width="1360px" height="552px" class="exciting_video" height="412px"
            poster="https://www.ly.gov.cn/templets/1/lysrmzf/video/luoyang.png" muted controls="controls"
            controlslist="nodownload">
            <source src="https://www.ly.gov.cn/templets/1/lysrmzf/video/luoyang.mp4" type="video/mp4">
          </video>
        </div>
        <div class="swiper-slide">
          <video width="1360px" height="552px" class="exciting_video" height="412px"
            poster="https://www.ly.gov.cn/templets/1/lysrmzf/video/luolyangydh.png" muted controls="controls"
            controlslist="nodownload">
            <source src="https://www.ly.gov.cn/templets/1/lysrmzf/video/luolyangydh.mp4" type="video/mp4">
          </video>
        </div>
        <div class="swiper-slide">
          <video width="1360px" height="552px" class="exciting_video" height="412px"
            poster="https://www.ly.gov.cn/templets/1/lysrmzf/video/luoyang5.png" muted controls="controls"
            controlslist="nodownload">
            <source src="https://www.ly.gov.cn/templets/1/lysrmzf/video/luoyang5.mp4" type="video/mp4">
          </video>
        </div>
        <div class="swiper-slide">
          <video width="1360px" height="552px" class="exciting_video" height="412px"
            poster="https://www.ly.gov.cn/templets/1/lysrmzf/video/luoyang4.png" muted controls="controls"
            controlslist="nodownload">
            <source src="https://www.ly.gov.cn/templets/1/lysrmzf/video/luoyang4.mp4" type="video/mp4">
          </video>
        </div>

      </div>
    </div>

j//s代码如下

var mySwiper = new Swiper('.swiper1', {
      pagination: '.pagination1',
      loop: true,
      grabCursor: true,
      on: {
        slideChangeTransitionEnd: function (swiper) {
          videoStopped()
        }
      }
    })
    //切换功能
        $('.arrow-left-1,.arrow-left-2').click(function (e) {
            videoStopped()
            e.preventDefault()
            mySwiper.slidePrev()
        })
        $('.arrow-right-1,.arrow-right-2').click(function (e) {
            videoStopped()
            e.preventDefault()
            mySwiper.slideNext()
        })

    //视频暂停
    function videoStopped() {
      $(".videoBox video").trigger('pause');
    }

    // html5-video标签屏蔽右键视频另存为的js代码
    $(".exciting_video").bind('contextmenu', function () {
      return false;
    })
  • 10
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值