随笔分类 - javascript
摘要:$(window).on("scroll",function(){ var sctop=$(window).scrollTop(); if ($(window).scrollTop() >= $(document).height() -$(window).height()){ alert("到底了") } })
阅读全文
摘要:你的浏览器不支持audio标签。--> #music { width: 0.8rem; height: 0.8rem; position: fixed; top: 0.2rem; right: 0.3rem; z-index: 9999; background-size: contain; text-align: center...
阅读全文
摘要:虽然很简单 也还是记录下, 插件方式 这些事很长多网站常见的小功能,不要觉得很简单,有时要用时直接copy ,还是省时间的
阅读全文
摘要:/* ** 时间戳显示为多少分钟前,多少天前的处理 ** eg. ** console.log(dateDiff(1411111111111)); // 2014年09月19日 ** console.log(dateDiff(1481111111111)); // 9月前 ** console.log(dateDiff(1499911111111)); // 2月前 ** console....
阅读全文
摘要:function capitalize(string){ var words =string.split(" "); for(var i=0;i<words.length;i++) { words[i]=words[i].charAt(0).toUpperCase()+words[i].slice(1); } return ...
阅读全文
摘要:<!doctype html><html><head><meta charset="utf-8"><title>JQuery之进度条</title> <!--加载google的jquer库y--><script src="http://ajax.googleapis.com/ajax/libs/jq
阅读全文
摘要:网页右键菜单 option1 option2 option3 我是美腻大方的绿方块
阅读全文
摘要:function is_weixn(){ var ua = navigator.userAgent.toLowerCase(); if(ua.match(/MicroMessenger/i)=="micromessenger") { return true; } else { return fals
阅读全文
摘要:var arr=[1,2,3,4,5,6] arr.forEach(function(index,item){ // console.log(item) // console.log(index) }) /...
阅读全文
摘要:http://www.cnblogs.com/YYvam1288/p/5123272.html 好的vue开源项目地址 http://www.cnblogs.com/opendigg/p/6513510.html http://www.cnblogs.com/diasa-fly/archive/20
阅读全文
摘要:直接上代码了,可以监听微信端,手机端,iOS端的浏览器返回事件,关闭事件不支持 当进入该页面,我们就给这个history压入一个本地的连接。当点击返回、后退及上一页的操作时,就进行监听,在监听代码中实现自己操作 window.addEventListener("popstate", function
阅读全文
摘要:什么是JS事件冒泡?: 在一个对象上触发某类事件(比如单击onclick事件),如果此对象定义了此事件的处理程序,那么此事件就会调用这个处理程序,如果没有定义此事件处理程序或者事件返回true,那么这个事件会向这个对象的父级对象传播,从里到外,直至它被处理(父级对象所有同类事件都将被激活),或者它到
阅读全文
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <button id="getPhoneCode"></button> <script src=
阅读全文
摘要:一切的碰撞都是通过网页中x,y坐标来计算的,判断两个矩形是否发生碰撞,就是判断它们是否有重合部分。理论上是这样,但是实际上我们应该考虑什么时候不重合,因为这种逆向思维会简单很多,如果一味考虑什么时候重合,一般人很难理得清楚。所以我们先理清楚不重合的情况,那么反过来就是重合的情况了。 不重合的情况:1
阅读全文

浙公网安备 33010602011771号