随笔分类 -  JavaScript

摘要:var browser = { versions: function() { var u = navigator.userAgent; var app = navigator.appVersion; return { trident: u.indexOf('Trident') > -1, pr... 阅读全文
posted @ 2018-09-01 12:56 美滋滋的胖虎 阅读(2225) 评论(0) 推荐(0)
摘要:document.body.addEventListener('touchmove', function(e) { e.stopPropagation();//阻止默认事件 e.preventDefault();//阻止冒泡 }); 阅读全文
posted @ 2018-08-31 10:03 美滋滋的胖虎 阅读(344) 评论(0) 推荐(0)
摘要:/* 函数名称:checkMobile() 功 能:检查输入手机号码是否正确 参 数:s格式字符串 返回结果:正确true/错误false */ function checkMobile(s){ if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(s))){ // alert( 阅读全文
posted @ 2018-08-30 23:15 美滋滋的胖虎 阅读(96) 评论(0) 推荐(0)
摘要:/*触摸屏幕时间事件(需要先引入JQ插件)*/ $.fn.extend({ mctap:function(func){ var _this=this; this.on('touchstart',function(e){ tiptimer=new Date(); }).on('touchend',fu 阅读全文
posted @ 2018-08-30 22:57 美滋滋的胖虎 阅读(498) 评论(0) 推荐(0)
摘要:function querymedia(){ var _mediatype=location.pathname.match(/miniwap(\w*)\//)[1]; _mediatype=_mediatype==''?0:_mediatype; return _mediatype;} 阅读全文
posted @ 2018-08-30 22:05 美滋滋的胖虎 阅读(208) 评论(0) 推荐(0)
摘要:注意添加到head标签内 <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>// 先引入官方文件 <script> wx.config({ debug: true, // 开启调试模式,调用的所有api的返回值会 阅读全文
posted @ 2018-08-30 21:32 美滋滋的胖虎 阅读(450) 评论(0) 推荐(0)
摘要:HTML部分: <div id="orientLayer" class="mod-orient-layer"> <div class="mod-orient-layer__content"> <i class="icon mod-orient-layer__icon-orient"></i> <di 阅读全文
posted @ 2018-08-30 21:22 美滋滋的胖虎 阅读(958) 评论(0) 推荐(0)
摘要:注意要将代码添加到head标签内 <script> var phoneWidth = parseInt(window.screen.width); var phoneScale = phoneWidth/640; var ua = navigator.userAgent; if (/Android 阅读全文
posted @ 2018-08-30 21:17 美滋滋的胖虎 阅读(419) 评论(0) 推荐(0)
摘要:此处以点击音乐图片sndctrl实现功能举例: HTML部分: <div class="sndctrl"> <img class="homeLoadingImg" data-src="images/a01.png"><i></i> <audio id="audio" src="media/music 阅读全文
posted @ 2018-08-30 21:09 美滋滋的胖虎 阅读(2514) 评论(0) 推荐(0)
摘要:HTML部分: <div id="loading" class="loading position"> <div class="spinner"> <div class="bounce1"></div> <div class="bounce2"></div> <div class="bounce3" 阅读全文
posted @ 2018-08-30 20:56 美滋滋的胖虎 阅读(480) 评论(0) 推荐(0)