H5 小代码(实时更新)
:before {
content: '';
display: inline-block;
vertical-align: middle;
height: %;
}
↑ 自适应垂直居中
.clearfix::after {
content: ".";
clear: both;
display: block;
overflow: hidden;
font-size: 0;
height: 0;
} .clearfix {
zoom: 1;
}
↑ 伪类清除浮动(直接将类名放入标签就可使用)
var a = 123456789;
a.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
↑ 给一段数字添加千分位逗号
var script = document.createElement('script');
script.src = "http://eruda.liriliri.io/eruda.min.js";
document.body.appendChild(script);
script.onload = function() {
eruda.init()
}
↑ 移动端调试器
window.alert = function (message) {
try {
var iframe = document.createElement("IFRAME");
iframe.style.display = "none";
iframe.setAttribute("src", 'data:text/plain,');
document.documentElement.appendChild(iframe);
var alertFrame = window.frames[0];
var iwindow = alertFrame.window;
if (iwindow == undefined) {
iwindow = alertFrame.contentWindow;
}
iwindow.alert(message);
iframe.parentNode.removeChild(iframe);
}
catch (exc) {
return wAlert(message);
}
}
↑ 移动端H5 去除alert的头部标题
.user_list::-webkit-scrollbar {display:none}
↑ overflow:scroll 隐藏滚动条
var weixin = navigator.userAgent.toLowerCase();
if(weixin.match(/MicroMessenger/i) == "micromessenger") {
alert("yep");
}
//判断当前使用是否为微信浏览器 var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //判断是否为安卓
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //判断是否为ios
↑ 判断当前H5使用环境
.Discoloration_span {
background-image: -webkit-gradient(linear, 0 0, 0 bottom, from(rgba(0, 140, 235, 1)), to(rgba(51, 255, 78, 1)));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
} @media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm) {
.Discoloration_span {
background-image: -webkit-linear-gradient(left, #008deb, #00ff4e 25%, #008deb 50%, #00ff4e 75%, #008deb);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
-webkit-background-size: 200% 100%;
-webkit-animation: masked-animation 2s infinite linear;
}
} @-webkit-keyframes masked-animation {
0% {
background-position: 0 0;
}
100% {
background-position: -100% 0;
}
}
↑ 字体颜色渐变+动画,class一粘即用,ie没兼容
jQuery.fn.shake = function(intShakes, intDistance, intDuration) {
this.each(function() {
var jqNode = $(this);
jqNode.css({
position: 'relative'
});
for(var x = ; x <= intShakes; x++) {
jqNode.animate({
left: (intDistance * -)
}, (((intDuration / intShakes) / )))
.animate({
left: intDistance
}, ((intDuration / intShakes) / ))
.animate({
left:
}, (((intDuration / intShakes) / )));
}
});
return this;
}
$(".ant_error").shake(, , );
↑ 文字抖动
oninput = "value=value.replace(/[^\d]/g,'')"
↑ input只能输入数字
display: flex;
flex-direction: row;
align-items: center;
↑ 自适应文字垂直居中
editTop: function(index) {
if (index-1 == -1) {
alert('no');
return;
}
this.test[index-1] = this.test.splice(index,1,this.test[index-1])[0];
}
↑ 数组元素上移
if(iframe.attachEvent) {
iframe.attachEvent("onload", function() { // IE
alert('ok');
});
} else {
iframe.onload = function() { // 非IE
alert('ok')
};
}
↑ 判断ifram是否加载完成
var _this = this;
$(document).mousedown(function(e) {
//点击选择框以外时关闭
if($(e.target).closest(".menu_model").length == 0) {
_this.areaIsShowMore = false;
}
});
↑ 点击选择框以外时关闭
changeURLArg(url, arg, arg_val){
var pattern=arg+'=([^&]*)';
var replaceText=arg+'='+arg_val;
if(url.match(pattern)){
var tmp='/('+ arg+'=)([^&]*)/gi';
tmp=url.replace(eval(tmp),replaceText);
return tmp;
}else{
if(url.match('[\?]')){
return url+'&'+replaceText;
}else{
return url+'?'+replaceText;
}
}
return url+'\n'+arg+'\n'+arg_val;
}
window.history.pushState(null, null, changeURLArg(window.location.href, "type", 1));
↑ 更改当前地址栏的某个参数并免加载在当前页面更换
<svg class="inst_store_svg_big">
<defs>
<linearGradient
id="grad"
x1="0%"
y1="50%"
x2="50%"
y2="90%"
>
<stop
offset="0%"
style="stop-color:#2F59F5; stop-opacity:1"
/>
<stop
offset="100%"
style="stop-color:#22B0FF; stop-opacity:1"
/>
</linearGradient>
</defs>
<text x="0" y="36" fill="url(#grad)">
店铺管理
</text>
</svg>
↑ 利用svg做到兼容IE的文字渐变
H5 小代码(实时更新)的更多相关文章
- JS小福利 —— 实时更新的页面小时钟
今天小女刚学会了一个好玩的小玩意儿~~特来跟大家分享一下~~~ 这是一个有趣的时钟显示程序,可以进行实时的年月日.星期.时分秒更新,有了这组小代码,以后可以作为日期插件应用在大型的JS代码中哦~~ 积 ...
- 解决 三星Note3 桌面小部件不实时更新/不刷新 的问题
机型及问题描述:我的是三星note3 (国行 SM-N9008V),已ROOT,安装了LBE安全大师.在桌面小部件中,有些不会实时更新.比如有 滴答清单(办过的事项无法勾选),百度云音乐(歌曲播放更新 ...
- MFC编辑框接收数据动态更新与刷新方法代码示例-如何让编辑框内容实时更新
MFC编辑框接收数据动态更新与刷新方法代码示例-如何让编辑框内容实时更新 关键代码: //发送数据通知 //from txwtech@163.com LRESULT CCommSampleDlg::O ...
- Egret白鹭H5小游戏开发入门(一)
前言: 好久没更新博客了,以前很多都不会,所以常常写博客总结,倒是现在有点点经验了就懒了.在过去的几个月里,在canvas游戏框架方面,撸过了CreateJS,玩得了Egret,又学过PIXI.js. ...
- 开发H5小游戏
Egret白鹭H5小游戏开发入门(一) 前言: 好久没更新博客了,以前很多都不会,所以常常写博客总结,倒是现在有点点经验了就懒了.在过去的几个月里,在canvas游戏框架方面,撸过了CreateJ ...
- facebook充值实时更新接口文档翻译 希望对做facebook充值的小伙伴有帮助
Realtime Updates for Payments are an essential method by which you are informed of changes to orders ...
- Egret白鹭H5小游戏开发入门(二)
前言: 昨天的文章中简单的介绍了Egret白鹭引擎从安装到基本的使用配置等问题,今天着重介绍H5小游戏开发的起步阶段,如Wing面板的使用,素材的处理,类的说明,开始布局等等. 整体概况: 根据上一篇 ...
- Egret白鹭H5小游戏开发入门(三)
前言: 在上一篇文章中着重介绍了H5小游戏开发的起步阶段,如Wing面板的使用,素材的处理,类的说明等等,那么今天主要是涉及到场景的创建,loading的修改等等的代码编写. 对于这一节,我在讲解的过 ...
- iOS学习网站及大牛网址(实时更新)
iOS学习网站及大牛网址(实时更新) 学习网站 https://github.com/Tim9Liu9/TimLiu-iOS 自己总结的iOS.mac开源项目及库 https://github.co ...
随机推荐
- nginx防DDOS、cc、爬虫攻击
一.防止DDOS.CC攻击 http { limit_conn_zone $binary_remote_addr zone=perip:10m; limit_conn_zone $server_nam ...
- 关于mysql的权限的问题
昨天因为同学的mysql数据库不知道做了什么操作,从而导致root用户无法使用了 具体是使用root用户不需要密码 进去只能看 看到 infomation_schema 表 ,感觉root权限丢失了 ...
- Java之Java的文件结构(才不是叛教!)
Java从入门到恰饭之文件结构,使用IDEA开发. 新建包 包名一般选择公司域名(https://tieba.baidu.com/)的反转 创建完成是这样的 对应的三层文件夹 我们创建一个类 pack ...
- Jmeter-【JSON Extractor】-响应结果中二级key取值
一.请求返回样式 二.取chapter的值 三.查看结果
- Mac OS 快速查询技巧
今天不知道按到什么快捷键弹出了这个搜索框,试了试很强大 后来查了才知道要双击键盘上的key (⌘)就会弹出,这个搜索很强大,要先安装QQ,QQ自带的 版权声明:本文为博主原创文章,未经博主允许不得转载 ...
- (转)Linux负载均衡软件LVS之一(概念篇)
转:http://ixdba.blog.51cto.com/2895551/552947 Linux负载均衡软件LVS之二(安装篇):http://ixdba.blog.51cto.com/28955 ...
- APC注入DLL(win7下有问题)
void APCKernelRoutine(PKAPC pKAPC, PKNORMAL_ROUTINE pUserAPC, PVOID pContext, PVOID pSysArg1, PVOID ...
- 数据结构C++版-树
一.概念 树是节点的有限集合. 二叉树: 二.补充知识点 1.<二叉树编码实战二>课程笔记: 递归的基本概念:程序调用自身的编程技巧称为递归,是函数自己调用自己. 迭代:利用变量的原值推算 ...
- GPIO, AFIO
o read/write the AFIO_EVCR, AFIO_MAPR and AFIO_EXTICRX registers, the AFIO clock should first be ena ...
- 使用反射机制,获取 ArrayList 的容量大小
本文所有说明及代码示例都是基于JDK 1.8 ArrayList 提供size()方法获取当前集合的元素数量,但无法知道当前集合的容量,翻看 ArrayList 的源代码,可以看到字段 elemen ...