前端开发小笔记

发布于2017年4月18日 21:35:31

一、pc端视频回调函数 用于调用接口
function playingNotify (){
alert('开始播放了')
}

二.移动端视频回调函数 用于调用接口
video.addEventLisener("playing",funciton(){

//函数执行

})

三、移动端:双击屏幕 阻止屏幕上弹
function proMove() {
var agent = navigator.userAgent.toLowerCase(); //检测是否是ios
var iLastTouch = null; //缓存上一次tap的时间
if (agent.indexOf('iphone') >= 0 || agent.indexOf('ipad') >= 0) {
document.body.addEventListener('touchend', function (event) {
var iNow = new Date().getTime();

iLastTouch = iLastTouch || iNow + 1 /** 第一次时将iLastTouch设为当前时间+1 */;
var delta = iNow - iLastTouch;
if (delta < 500 && delta > 0) {
event.preventDefault();
return false;
}
iLastTouch = iNow;
}, false);
}
}
proMove();

原文地址:http://www.qdfuns.com/notes/40664/6a5e52fc874ddf702ce5239223700ca1.html

本文共 3 个回复

  • WGinit 博主 2023/06/25 21:44

    hh ❓

  • WGinit 博主 2023/06/25 21:46

    xixi 😎

回复 WGinit 取消