: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 小代码(实时更新)的更多相关文章

  1. JS小福利 —— 实时更新的页面小时钟

    今天小女刚学会了一个好玩的小玩意儿~~特来跟大家分享一下~~~ 这是一个有趣的时钟显示程序,可以进行实时的年月日.星期.时分秒更新,有了这组小代码,以后可以作为日期插件应用在大型的JS代码中哦~~ 积 ...

  2. 解决 三星Note3 桌面小部件不实时更新/不刷新 的问题

    机型及问题描述:我的是三星note3 (国行 SM-N9008V),已ROOT,安装了LBE安全大师.在桌面小部件中,有些不会实时更新.比如有 滴答清单(办过的事项无法勾选),百度云音乐(歌曲播放更新 ...

  3. MFC编辑框接收数据动态更新与刷新方法代码示例-如何让编辑框内容实时更新

    MFC编辑框接收数据动态更新与刷新方法代码示例-如何让编辑框内容实时更新 关键代码: //发送数据通知 //from txwtech@163.com LRESULT CCommSampleDlg::O ...

  4. Egret白鹭H5小游戏开发入门(一)

    前言: 好久没更新博客了,以前很多都不会,所以常常写博客总结,倒是现在有点点经验了就懒了.在过去的几个月里,在canvas游戏框架方面,撸过了CreateJS,玩得了Egret,又学过PIXI.js. ...

  5. 开发H5小游戏

    Egret白鹭H5小游戏开发入门(一)   前言: 好久没更新博客了,以前很多都不会,所以常常写博客总结,倒是现在有点点经验了就懒了.在过去的几个月里,在canvas游戏框架方面,撸过了CreateJ ...

  6. facebook充值实时更新接口文档翻译 希望对做facebook充值的小伙伴有帮助

    Realtime Updates for Payments are an essential method by which you are informed of changes to orders ...

  7. Egret白鹭H5小游戏开发入门(二)

    前言: 昨天的文章中简单的介绍了Egret白鹭引擎从安装到基本的使用配置等问题,今天着重介绍H5小游戏开发的起步阶段,如Wing面板的使用,素材的处理,类的说明,开始布局等等. 整体概况: 根据上一篇 ...

  8. Egret白鹭H5小游戏开发入门(三)

    前言: 在上一篇文章中着重介绍了H5小游戏开发的起步阶段,如Wing面板的使用,素材的处理,类的说明等等,那么今天主要是涉及到场景的创建,loading的修改等等的代码编写. 对于这一节,我在讲解的过 ...

  9. iOS学习网站及大牛网址(实时更新)

    iOS学习网站及大牛网址(实时更新) 学习网站 https://github.com/Tim9Liu9/TimLiu-iOS  自己总结的iOS.mac开源项目及库 https://github.co ...

随机推荐

  1. Sublime Text3中MarkDown的使用

    前言 当我们想要在Sublime文本编辑器中编辑markdown时,需要先安装markdown插件,因为Sublime里默认没有安装该插件,同时在编辑markdown文本时可以实时预览编辑效果. 具体 ...

  2. [翻译]windows下 连接到 bitnami的phpmyadmin

    bitnami 因为安全考虑,只能 localhost 访问 phpmyadmin 为了能通过SSH 隧道访问 phpMyAdmin,你需要一个ssh 客户端.参考文章介绍使用中选择使用 PuTTY, ...

  3. 单个机器部署redis集群模式(一键部署脚本)

    一.检查机器是否安装gcc.unzip.wget 二.部署模式 #模式1: 将所有主从节点以及sentinel节点部署在同一台机器上 #模式2: 将一个数据节点和一个sentinel节点部署在一台机器 ...

  4. 在Vue项目中,添加的背景图片在服务器上不显示,如何处理

    遇到的问题: 在vue项目开发过程中,我们常常会在页面中添加背景图片.可是当我们在样式中添加了背景图片,编译打包部署到服务器上时,发现图片并不能显示出来,这是为什么呢~~~ 我们一般写的css样式如下 ...

  5. 【JZOJ3294】【BZOJ4417】【luoguP3990】超级跳马

    description analysis 矩阵乘法好题 最朴素的\(10pts\)的\(f[i][j]\)容易\(DP\),但是是\(O(nm^2)\)的复杂度 于是把\(10\)分的\(DP\)写出 ...

  6. 【JZOJ6285】飘雪圣域

    description analysis 从求联通块出发根本没做法,于是考虑连通块里面的边 对于一个询问\([l,r]\),一条边的左端点\(≥l\)且右端点\(≤r\)才在这个区间的点之间 于是对于 ...

  7. 面向对象oop 和类

    面向对象与面向过程的区别 面向对象:面向对象的思维模式说白了就是分类思维模式.思考问题首先会解决问题需要哪些分类,然后对这些分类进行单独思考.最后,才对某个分类下的细节进行面向过程的思索 自我理解(领 ...

  8. (转)sql的group by应用

    转载于:http://www.studyofnet.com/news/247.html 本文导读:在实际SQL应用中,经常需要进行分组聚合,即将查询对象按一定条件分组,然后对每一个组进行聚合分析.创建 ...

  9. Rabbit MQ 客户端 API 进阶

    之前说了一些基础的概念及使用方法,比如创建交换器.队列和绑定关系等.现在我们再来补充一下细节性的东西. 备份交换器 通过声明交换器的时候添加 alternate-exchange 参数来实现. Con ...

  10. 漏洞:会话固定攻击(session fixation attack)

    什么是会话固定攻击? 会话固定攻击(session fixation attack)是利用应用系统在服务器的会话ID固定不变机制,借助他人用相同的会话ID获取认证和授权,然后利用该会话ID劫持他人的会 ...