随笔分类 - JS技能
js技能笔记
该文被密码保护。
摘要:1, this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
阅读全文
摘要:引入引擎文件 template.js 1,定义引擎模块 <script type="text/html" class="card-tpl"> <!-- 生成案例列表循环 --> <%for(var i = 0;i < cards.length; i++){%> <div class="card-wr
阅读全文
摘要:1, // 根据屏幕宽度,动态设置字体的大小 !function(o, e) { var n = o.documentElement, t = (window, function() { var o = n.clientWidth; o && (n.style.fontSize = o > 768
阅读全文
摘要:1, 移动端click时间、touch事件、tap事件详解 一、click 和 tap 比较 两者都会在点击时触发,但是在手机WEB端,click会有 200~300 ms,所以请用tap代替click作为点击事件。 singleTap和doubleTap 分别代表单次点击和双次点击。 二、关于ta
阅读全文
摘要:1, 打开链接时 ,改为 replace的方式打开 // window.location.href = "" + url; window.location.replace("" + url); js禁止原生手机返回键(物理返回键) $(document).ready(function() { if
阅读全文
摘要:1, !function() { var t = navigator.userAgent.toLowerCase(), a = 1; /iphone|ipad|ipod/.test(t) ? a = 2 : /android/.test(t) && (a = 1), //判断是不是微信浏览器 2 =
阅读全文
摘要:1,就是为了让匿名函数在声明完后就立即执行
阅读全文
摘要:1,test方法 2,toLowerCase方法 3,match
阅读全文
摘要:1, 为什么要使用FastClick 移动设备上的浏览器默认会在用户点击屏幕大约延迟300毫秒后才会触发点击事件,这是为了检查用户是否在做双击。为了能够立即响应用户的点击事件,才有了FastClick。 项目地址:https://github.com/ftlabs/fastclick 2,使用 $(
阅读全文
摘要:1,class类的定义 class WebAR { /** * 初始化Web AR * @param interval 识别间隔(毫秒) * @param recognizeUrl 识别服务地址 * @param isDebug 是否输入调试信息 * @param token 非必需,使用token
阅读全文
摘要:1, httpPost(image) { return new Promise((resolve, reject) => { const http = new XMLHttpRequest(); http.onload = () => { try { const msg = JSON.parse(h
阅读全文
摘要:1, var str = {"name":"菜鸟教程", "site":"http://www.runoob.com"} str_pretty1 = JSON.stringify(str)
阅读全文
摘要:1, <canvas id="canvas" width="5" height="5"></canvas> 可以用这样的方式获取一个 data-URL var canvas = document.getElementById("canvas"); var dataURL = canvas.toDat
阅读全文
摘要:JS中find(), findIndex(), filter(), forEach(), some(), every(), map()方法 1. find()与findIndex() find()方法,用于找出第一个符合条件的数组成员。它的参数是一个回调函数,所有数组成员依次执行该回调函数,直到找出
阅读全文
摘要:1, listCamera(videoDevice) { return new Promise((resolve, reject) => { navigator.mediaDevices.enumerateDevices() .then((devices) => { let index = 1; d
阅读全文
摘要:1, document.querySelector('#openCamera').addEventListener('click', function () { const videoSelect = document.querySelector('#videoDevice'); webAR.lis
阅读全文
摘要:1, 有bind(this)就能获取 this.bl_First 的值,否则就不能获取值
阅读全文