: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. Swift与OC混合开发

    一.Swift调用OC 1. 创建{targetName}-Bridging-Header.h头文件,在BuildSetting -> bridging 2. Swift文件调用的OC中的类的头 ...

  2. 在阿里云 既php和mysql装好之后,如何安装zabbix

    首先找到php.ini这个文件 命令如下 find / -name php.ini 然后参数修改为如下,不改装不了 max_execution_time = 300  memory_limit = 1 ...

  3. vue app外卖(5) 使用swiper 进行图片轮播

    1.查看swiper 文档 https://www.swiper.com.cn/usage/index.html 2. 下载 npm install --save swiper 3.在页面引入 imp ...

  4. html input 上capture 参数在 安卓 苹果上的异同

    安卓上 <input type="file" accept="image/*" capture="camera"> //只调用相 ...

  5. 通过statCounter计算给定的RDD[Double]的统计信息的方法

    需求1:给定一个RDD[Double],进行计算,该RDD的统计信息(count,mean,stdev,max,min) 代码: def main(args: Array[String]): Unit ...

  6. element中的tree组件实现菜单分配

    返回的菜单数据 tree组件的使用 <el-tree ref="menuList" // :data="menuList" // 展示数据 :props= ...

  7. Eclipse+Maven创建webapp项目 及部署在tomcat上

    1.开启eclipse,右键new——>other,如下图找到maven project 2.选择maven project,显示创建maven项目的窗口,勾选如图所示,Create a sim ...

  8. 《转》python8元组

    转自 http://www.cnblogs.com/BeginMan/p/3156235.html 一.元组特性 1.类似列表,但不可变类型,正因如此,它可以做一个字典的key2.当处理一组对象时,这 ...

  9. 大道浮屠诀---NBU报错代码之status2

    在一次windows2008R2系统上部署7.7.3备份过程中遇到了此报错 当备份catalog时,会出现status 2报错 经过一系列排查后,得出如下解决方法 1.任务进程中有大量的nbtelem ...

  10. jdbc_mysql----函数助手参数化

    第一个值填写的是文件路径 第二个值填写的是从第几个开始执行,从0开始