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 ...
随机推荐
- 3306端口被占用导致MySQL无法启动
报错:mysql服务无法启动1067 发现WINDOWS下面没有MYSQL的服务在MYSQL的安装目录bin下面安装MYSQL服务:C:\Program Files\MySQL\MySQL Serve ...
- Mysql优化-分区
分区简介 分区是根据一定的规则,数据库把一个表分解成多个更小的.更容易管理的部分.就访问数据库应用而言,逻辑上就只有一个表或者一个索引,但实际上这个表可能有N个物理分区对象组成,每个分区都是一个独立的 ...
- TFS发布的时候出现 ENOENT: no such file or directory, stat 'E:\vsts-agent\_work\r57\a\KingEagle-Mysql-Dev\drop\12917.zip' 解决方案
出现 ENOENT: no such file or directory, stat 'E:\vsts-agent\_work\r57\a\KingEagle-Mysql-Dev\drop\12917 ...
- WindowsPowerShell常用命令
zai 获得Shell权限之后,可使用如下命令对系统进行文件操作: cd 后跟相应参数: cd ../ 返回上一级目录 cd +路径 跳转至制定目录(如果路径存在且正确的话) type flag.tx ...
- 【转载】WebRTC基于GCC的拥塞控制(上) - 算法分析
实时流媒体应用的最大特点是实时性,而延迟是实时性的最大敌人.从媒体收发端来讲,媒体数据的处理速度是造成延迟的重要原因:而从传输角度来讲,网络拥塞则是造成延迟的最主要原因.网络拥塞可能造成数据包丢失,也 ...
- 阶乘质因子分解——lightoj1035
#include<bits/stdc++.h> using namespace std; #define ll long long #define maxn 200 int primes[ ...
- 一次Spring Transactional嵌套事务使用不同的rollbackFor的分析
起因: 项目期间由于一次异常回滚问题,发现自己在事务知识方面知识的遗漏,趁着这次机会,做了几次rollbackFor的测试. 测试: 现在有两个事务,事务oute包含事务Inner.事务A回滚规则 ...
- Go将统治下一个10年?Go语言发展现状分析
“本文是国内Go语言大中华区首席布道师——许式伟,在QCon2015上海站上的分享.他预测Go语言10年内一定会超过C和java,并且统治这一个10年. Go语言语法及标准库变化 Go从1.0版本到现 ...
- Java 并发总结(三)
锁优化及注意事项 有助于提高锁的性能 减小所持有时间:例如不要对方法直接加锁,而是在方法中对具体访问临界资源的代码加锁 减小锁粒度:如ConcurrentHashMap 用读写锁代替独占锁 锁分离:如 ...
- java执行顺序之深入理解clinit和init
原文地址:https://blog.csdn.net/qq_36522306/article/details/80582758 前言: 最近研究了深入理解JVM这本书中的知识,对java中各部分执行的 ...