: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. php漂亮的分页类

    <?php    /*    * PHP分页类    * @package Page    * @Created 2013-03-27    * @Modify  2013-03-27    * ...

  2. 单源最短路径问题1 (Bellman-Ford算法)

    /*单源最短路径问题1 (Bellman-Ford算法)样例: 5 7 0 1 3 0 3 7 1 2 4 1 3 2 2 3 5 2 4 6 3 4 4 输出: [0, 3, 7, 5, 9] */ ...

  3. 使用Thread创建线程

    #_author:来童星#date:2019/12/17#使用Thread创建线程import threadingimport timeclass Sunthread(threading.Thread ...

  4. BASS HOME

     http://www.un4seen.com/

  5. idea中添加mysql驱动jia包的方法

    1 将相关jar包拷贝到自己所建的lib 文件夹下  如下图所示 2   选中自己的module  接着选择Project Structure 如下图 3 接着如下图继续操作 如上图完成后  那么我们 ...

  6. QueryList 来做采集是什么样子

    采集百度搜索结果列表的标题和链接. $data = QueryList::get('https://www.baidu.com/s?wd=QueryList') // 设置采集规则 ->rule ...

  7. delphi 获取所有窗口标题

    unit Unit1; interface usesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, ...

  8. BZOJ 3083: 遥远的国度 (树剖+线段树)

    传送门 解题思路 前两个操作都比较基础.对于第三个操作分类讨论一下,首先如果当前根不是要操作点的子树,那么就无影响,直接查询操作点的子树即可.第二种是当前根是操作点的子树,那就找到当前根到操作点这条链 ...

  9. pytorch处理模型过拟合

    演示代码如下 import torch from torch.autograd import Variable import torch.nn.functional as F import matpl ...

  10. sqlalchemy之create_engine和session

    sqlalchemy之create_engine和session orm 实质上,一个O/R Mapping会为你生成DAL.(即为数据访问层(Data Access Layer).其功能主要是负责数 ...