js
鱼与雨于语
记录
展开
-
比较数组值大小
//返回最大值function ( array ){ return Math.max.apply( Math, array );};//返回最小值function ( array ){ return Math.min.apply( Math, array );};原创 2021-09-09 10:18:52 · 982 阅读 · 0 评论 -
移动端解决点击穿透
$('.a').on('click',function(e){e.preventDefault();})原创 2021-08-18 17:45:02 · 82 阅读 · 0 评论 -
echarts 地图
<!DOCTYPE html><html lang="zh-CN"><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scal.原创 2021-06-23 16:33:50 · 410 阅读 · 1 评论 -
JS监听浏览器的返回、后退、上一页按钮的事件方法
在实际的应用中,我们常常需要实现在移动app和浏览器中点击返回、后退、上一页等按钮实现自己的关闭页面、调整到指定页面或执行一些其它操作的需求,那在代码中怎样监听当点击微信、支付宝、百度糯米、百度钱包等app的返回按钮或者浏览器的上一页或后退按钮的事件呢。我相信很多朋友像我一样,在百度、搜狗里面搜索很久都没找到方法。下面就来告诉大家怎样监听的方法:首先我们要了解浏览器的history。大家知道在页面中我们可以使用javascript window history,后退到前面页面,但是由于...原创 2021-04-10 17:07:28 · 804 阅读 · 2 评论 -
js记录
textContent 获取标签内文本内容原创 2021-03-24 16:53:37 · 67 阅读 · 0 评论 -
5分钟 数字时间倒计时 js
vartimer=0;$.fn.countDown=function(options){var$myBar=$(this);vardefaultOpts={dataTime:'',downEnd:function(){}}varopts=$.extend({},defaultOpts,options);...原创 2021-03-13 14:29:42 · 2076 阅读 · 0 评论 -
window.onscroll
window.onscroll=function(){varscrollT=document.documentElement.scrollTop;}原创 2021-01-29 17:25:42 · 414 阅读 · 0 评论 -
关于es6中...运算符的总结
一、...为展开运算符let a = [1,2,3];let b = [0, ...a, 4]; // [0,1,2,3,4]let obj = { a: 1, b: 2 };let obj2 = { ...obj, c: 3 }; // { a:1, b:2, c:3 }let obj3 = { ...obj, a: 3 }; // { a:3, b:2 }二、...为剩余操作符let a = [1,2,3];let [b, ...c] = a;b; // 1c; // [2.原创 2021-01-29 16:45:05 · 111 阅读 · 0 评论 -
js文件命名为page.index.js微信内置浏览器 js不执行
js文件命名为page.index.js微信内置浏览器 js不执行手机型号:oppo reno ace原创 2020-11-19 16:59:50 · 185 阅读 · 0 评论 -
jquery自定义分页插件(带回调函数) 链接分享
https://www.cnblogs.com/x0216u/p/7463679.html原创 2020-06-02 17:35:29 · 155 阅读 · 0 评论 -
阻止点击事件冒泡
//需要排除的元素 阻止点击事件冒泡$('.a').click(function(e){ e.stopPropagation();})$('body').click(function(e){ if($(e.target) !== $('.a')){ //除了元素.a 之外的空白 }})原创 2020-05-30 13:40:08 · 322 阅读 · 0 评论 -
网站 灰色调
如何让实现整站变灰色调 (一般用于悼念活动)html{filter: grayscale(100%);filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%);-moz-filter: grayscale(100%);}那么问题来了,IE 10...原创 2020-04-03 17:43:35 · 451 阅读 · 0 评论 -
判断是移动端还是PC端
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { document.write("移动") } else { document.write("PC") }...原创 2020-04-01 14:31:08 · 342 阅读 · 0 评论 -
倒计时 canvas 绘制
不能匀速 还不知道咋改<!DOCTYPE html><html><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equ...原创 2019-07-29 09:12:32 · 173 阅读 · 0 评论 -
吸顶插件
/** * 吸顶 * $('el').ceilFn({ className: "fixed_top", bottomEle: '.all-type-tag', num1: 20, num2: 60 }); * */;(function($){ // 吸顶 js $.fn.ceilF...原创 2019-03-04 17:33:43 · 210 阅读 · 0 评论 -
textarea根据输入内容增高
$.fn.extend({ autoHeight: function(){ return this.each(function(){ var $this = $(this); console.log($this.outerHeight()); ...原创 2018-12-17 09:43:50 · 208 阅读 · 0 评论